diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
commit | 0695d6366a670e1dd9b6b0ca463feec12ab659d7 (patch) | |
tree | baf248c43e42f8a479fb46dd21a916180575ac9b /test | |
parent | 68659dd411a8ca3b0b2ef86eaaa7d5ba5d5bc449 (diff) | |
parent | 8fc9a9ba251ea34ac5a943ad8eb7f6cf012b929d (diff) | |
download | hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.zip hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.gz hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.bz2 |
[svn-r27835] Description:
Sync w/trunk.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial & parallel
(h5committest not required on this branch)
Diffstat (limited to 'test')
154 files changed, 1270 insertions, 730 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dc79cdb..f9832f3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -258,7 +258,7 @@ set (H5_TESTS #links_env file_image enc_dec_plist - enc_dec_plist_with_endianess + enc_dec_plist_cross_platform unregister ) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 662b8c9..b093064 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -139,47 +139,83 @@ endif (HDF5_TEST_VFD) # Copy test files from test/testfiles/plist_files dir to test dir # -------------------------------------------------------------------- set (HDF5_REFERENCE_PLIST_FILES - acpl_be - acpl_le - dapl_be - dapl_le - dcpl_be - dcpl_le - dxpl_be - dxpl_le - fapl_be - fapl_le - fcpl_be - fcpl_le - gcpl_be - gcpl_le - lapl_be - lapl_le - lcpl_be - lcpl_le - ocpl_be - ocpl_le - ocpypl_be - ocpypl_le - strcpl_be - strcpl_le + acpl_32be + acpl_32le + acpl_64be + acpl_64le + dapl_32be + dapl_32le + dapl_64be + dapl_64le + dcpl_32be + dcpl_32le + dcpl_64be + dcpl_64le + dxpl_32be + dxpl_32le + dxpl_64be + dxpl_64le + fapl_32be + fapl_32le + fapl_64be + fapl_64le + fcpl_32be + fcpl_32le + fcpl_64be + fcpl_64le + gcpl_32be + gcpl_32le + gcpl_64be + gcpl_64le + lapl_32be + lapl_32le + lapl_64be + lapl_64le + lcpl_32be + lcpl_32le + lcpl_64be + lcpl_64le + ocpl_32be + ocpl_32le + ocpl_64be + ocpl_64le + ocpypl_32be + ocpypl_32le + ocpypl_64be + ocpypl_64le + strcpl_32be + strcpl_32le + strcpl_64be + strcpl_64le ) foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}") + set (dest "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files") add_custom_command ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile} + ) + add_custom_command ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile} ) if (BUILD_SHARED_LIBS) - set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}") + set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files") + add_custom_command ( + TARGET ${HDF5_TEST_LIBSH_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile} + ) add_custom_command ( TARGET ${HDF5_TEST_LIBSH_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile} ) endif (BUILD_SHARED_LIBS) endforeach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) diff --git a/test/Makefile.am b/test/Makefile.am index 7588dc0..d9c53d4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -44,7 +44,7 @@ TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ - set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ + set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf vds farray earray btree2 fheap file_image unregister diff --git a/test/Makefile.in b/test/Makefile.in index 715fbf4..0930e3e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,17 @@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -96,14 +106,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \ - $(srcdir)/testcheck_version.sh.in $(srcdir)/testerror.sh.in \ - $(srcdir)/H5srcdir_str.h.in $(srcdir)/testlibinfo.sh.in \ - $(srcdir)/testlinks_env.sh.in $(srcdir)/test_plugin.sh.in \ - $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/test-driver \ - COPYING @HAVE_SHARED_CONDITIONAL_TRUE@am__append_1 = test_plugin.sh @HAVE_SHARED_CONDITIONAL_TRUE@am__append_2 = plugin$(EXEEXT) check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \ @@ -116,10 +118,14 @@ TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ - $(top_srcdir)/m4/aclocal_fc.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/aclocal_fc.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/H5config.h \ $(top_builddir)/fortran/src/H5config_f.inc CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir_str.h \ @@ -192,7 +198,7 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ - enc_dec_plist_with_endianess$(EXEEXT) getname$(EXEEXT) \ + enc_dec_plist_cross_platform$(EXEEXT) getname$(EXEEXT) \ vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ freespace$(EXEEXT) mf$(EXEEXT) vds$(EXEEXT) farray$(EXEEXT) \ @@ -281,11 +287,11 @@ enc_dec_plist_SOURCES = enc_dec_plist.c enc_dec_plist_OBJECTS = enc_dec_plist.$(OBJEXT) enc_dec_plist_LDADD = $(LDADD) enc_dec_plist_DEPENDENCIES = libh5test.la $(LIBHDF5) -enc_dec_plist_with_endianess_SOURCES = enc_dec_plist_with_endianess.c -enc_dec_plist_with_endianess_OBJECTS = \ - enc_dec_plist_with_endianess.$(OBJEXT) -enc_dec_plist_with_endianess_LDADD = $(LDADD) -enc_dec_plist_with_endianess_DEPENDENCIES = libh5test.la $(LIBHDF5) +enc_dec_plist_cross_platform_SOURCES = enc_dec_plist_cross_platform.c +enc_dec_plist_cross_platform_OBJECTS = \ + enc_dec_plist_cross_platform.$(OBJEXT) +enc_dec_plist_cross_platform_LDADD = $(LDADD) +enc_dec_plist_cross_platform_DEPENDENCIES = libh5test.la $(LIBHDF5) enum_SOURCES = enum.c enum_OBJECTS = enum.$(OBJEXT) enum_LDADD = $(LDADD) @@ -567,7 +573,7 @@ SOURCES = $(libdynlib1_la_SOURCES) $(libdynlib2_la_SOURCES) \ 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 earray.c efc.c \ - enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \ + enc_dec_plist.c enc_dec_plist_cross_platform.c enum.c \ err_compat.c error_test.c extend.c external.c farray.c fheap.c \ file_image.c fillval.c filter_fail.c flush1.c flush2.c \ freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ @@ -586,7 +592,7 @@ DIST_SOURCES = $(am__libdynlib1_la_SOURCES_DIST) \ 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 earray.c efc.c \ - enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \ + enc_dec_plist.c enc_dec_plist_cross_platform.c enum.c \ err_compat.c error_test.c extend.c external.c farray.c fheap.c \ file_image.c fillval.c filter_fail.c flush1.c flush2.c \ freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ @@ -798,6 +804,12 @@ am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.in \ + $(srcdir)/test_plugin.sh.in $(srcdir)/testcheck_version.sh.in \ + $(srcdir)/testerror.sh.in $(srcdir)/testlibinfo.sh.in \ + $(srcdir)/testlinks_env.sh.in $(top_srcdir)/bin/depcomp \ + $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \ + $(top_srcdir)/config/conclude.am COPYING DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ @@ -815,7 +827,6 @@ AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -913,6 +924,7 @@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -1135,7 +1147,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ - set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ + set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf vds farray earray btree2 fheap file_image unregister @@ -1215,7 +1227,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -1224,7 +1235,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am: +$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -1395,9 +1406,9 @@ enc_dec_plist$(EXEEXT): $(enc_dec_plist_OBJECTS) $(enc_dec_plist_DEPENDENCIES) $ @rm -f enc_dec_plist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(enc_dec_plist_OBJECTS) $(enc_dec_plist_LDADD) $(LIBS) -enc_dec_plist_with_endianess$(EXEEXT): $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_DEPENDENCIES) $(EXTRA_enc_dec_plist_with_endianess_DEPENDENCIES) - @rm -f enc_dec_plist_with_endianess$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_LDADD) $(LIBS) +enc_dec_plist_cross_platform$(EXEEXT): $(enc_dec_plist_cross_platform_OBJECTS) $(enc_dec_plist_cross_platform_DEPENDENCIES) $(EXTRA_enc_dec_plist_cross_platform_DEPENDENCIES) + @rm -f enc_dec_plist_cross_platform$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(enc_dec_plist_cross_platform_OBJECTS) $(enc_dec_plist_cross_platform_LDADD) $(LIBS) enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES) $(EXTRA_enum_DEPENDENCIES) @rm -f enum$(EXEEXT) @@ -1659,7 +1670,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist_with_endianess.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist_cross_platform.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_test.Po@am__quote@ @@ -1858,7 +1869,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ - else \ + elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ @@ -2203,9 +2214,9 @@ enc_dec_plist.log: enc_dec_plist$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -enc_dec_plist_with_endianess.log: enc_dec_plist_with_endianess$(EXEEXT) - @p='enc_dec_plist_with_endianess$(EXEEXT)'; \ - b='enc_dec_plist_with_endianess'; \ +enc_dec_plist_cross_platform.log: enc_dec_plist_cross_platform$(EXEEXT) + @p='enc_dec_plist_cross_platform$(EXEEXT)'; \ + b='enc_dec_plist_cross_platform'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ @@ -2503,6 +2514,8 @@ uninstall-am: uninstall-libLTLIBRARIES pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ uninstall-libLTLIBRARIES +.PRECIOUS: Makefile + # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. # This tells the Makefiles that these targets are not files to be built but diff --git a/test/accum.c b/test/accum.c index a924517..268b7e1 100644 --- a/test/accum.c +++ b/test/accum.c @@ -17,7 +17,7 @@ */ #include "h5test.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5FDprivate.h" #include "H5Iprivate.h" diff --git a/test/app_ref.c b/test/app_ref.c index 3052df7..4b72bcb 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -185,6 +185,10 @@ main (void) PASSED(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + /* Clean up any file(s) created */ h5_reset(); fapl = H5Pcreate (H5P_FILE_ACCESS); h5_cleanup (FILENAME, fapl); @@ -120,7 +120,7 @@ static hsize_t values_used[WRT_N]; static hsize_t randll(hsize_t limit, int current_index) { - hsize_t acc; + hsize_t acc = 0; int overlap = 1; int i; int tries = 0; @@ -618,8 +618,8 @@ test_sec2(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); return 0; error: @@ -655,8 +655,8 @@ test_stdio(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); HDfflush(stdout); return 0; @@ -716,8 +716,8 @@ test_family(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); return 0; error: diff --git a/test/bittests.c b/test/bittests.c index c527bb8..c4dfe4c 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -21,7 +21,7 @@ */ #include "h5test.h" -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #define NTESTS 100000 diff --git a/test/btree2.c b/test/btree2.c index d8abc84..caad849 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5B2 package. * This file also needs to access the v2 B-tree testing code. */ -#define H5B2_PACKAGE +#define H5B2_FRIEND /*suppress error about including H5B2pkg */ #define H5B2_TESTING #include "H5B2pkg.h" diff --git a/test/cache_common.h b/test/cache_common.h index 737c53f..9e8c5ba 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -22,8 +22,8 @@ #ifndef _CACHE_COMMON_H #define _CACHE_COMMON_H -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /* Include library header files */ #include "H5ACprivate.h" diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 84c9b34..2d22b5b 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -1113,6 +1113,7 @@ check_dense_attribute_tags(void) /* Create dataset */ if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* get dataset object header */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2025,6 +2026,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2159,6 +2161,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; if (( did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2287,6 +2290,7 @@ check_dataset_open_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2419,6 +2423,7 @@ check_dataset_write_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2709,6 +2714,7 @@ check_dataset_read_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2847,6 +2853,7 @@ check_dataset_size_retrieval(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2986,6 +2993,7 @@ check_dataset_extend_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -3367,6 +3375,7 @@ check_link_removal_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -3526,6 +3535,7 @@ check_link_getname_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5c591f8..22bf3a2 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -21,7 +21,7 @@ /* See H5private.h for how to include headers */ #undef NDEBUG -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" /*to turn off hardware conversions*/ #include "H5Iprivate.h" diff --git a/test/dsets.c b/test/dsets.c index 136fec2..a233b4e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -26,7 +26,7 @@ /* * This file needs to access private information from the H5Z package. */ -#define H5Z_PACKAGE +#define H5Z_FRIEND #include "h5test.h" @@ -389,11 +389,11 @@ static herr_t test_simple_io(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; - hid_t file, dataset, space, xfer; + hid_t file = -1, dataset = -1, space = -1, xfer = -1; int i, j, n; hsize_t dims[2]; void *tconv_buf = NULL; - int f; + int f = -1; haddr_t offset; int rdata[DSET_DIM1][DSET_DIM2]; @@ -425,6 +425,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + if(H5Sclose(space) < 0) TEST_ERROR + space = -1; /* Test dataset address. Should be undefined. */ if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error; @@ -455,8 +457,11 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } if(H5Pclose (xfer) < 0) goto error; + xfer = -1; if(H5Dclose(dataset) < 0) goto error; + dataset = -1; if(H5Fclose(file) < 0) goto error; + file = -1; f = HDopen(filename, O_RDONLY, 0); HDlseek(f, (off_t)offset, SEEK_SET); @@ -475,8 +480,9 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } HDclose(f); + f = -1; - HDfree (tconv_buf); + HDfree(tconv_buf); PASSED(); } /* end if */ else { @@ -487,6 +493,18 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) return 0; error: + if(space > 0) + if(H5Sclose(space) < 0) TEST_ERROR + if(xfer > 0) + if(H5Pclose(xfer) < 0) TEST_ERROR + if(dataset > 0) + if(H5Dclose(dataset) < 0) TEST_ERROR + if(file > 0) + if(H5Fclose(file) < 0) TEST_ERROR + if(f > 0) + HDclose(f); + if(tconv_buf) + HDfree(tconv_buf); return -1; } @@ -509,10 +527,10 @@ static herr_t test_userblock_offset(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; - hid_t file, fcpl, dataset, space; + hid_t file = -1, fcpl = -1, dataset = -1, space = -1; int i, j; hsize_t dims[2]; - int f; + int f = -1; haddr_t offset; int rdata[DSET_DIM1][DSET_DIM2]; @@ -527,6 +545,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; + if(H5Pclose(fcpl) < 0) TEST_ERROR + fcpl = -1; /* Create the data space */ dims[0] = DSET_DIM1; @@ -536,6 +556,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + if(H5Sclose(space) < 0) TEST_ERROR + space = -1; /* Write the data to the dataset */ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) @@ -547,7 +569,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) if((offset = H5Dget_offset(dataset)) == HADDR_UNDEF) goto error; if(H5Dclose(dataset) < 0) goto error; + dataset = -1; if(H5Fclose(file) < 0) goto error; + file = -1; f = HDopen(filename, O_RDONLY, 0); HDlseek(f, (off_t)offset, SEEK_SET); @@ -566,6 +590,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) } HDclose(f); + f = -1; PASSED(); } /* end if */ @@ -577,6 +602,16 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) return 0; error: + if(space > 0) + if(H5Sclose(space) < 0) TEST_ERROR + if(fcpl > 0) + if(H5Pclose(fcpl) < 0) TEST_ERROR + if(dataset > 0) + if(H5Dclose(dataset) < 0) TEST_ERROR + if(file > 0) + if(H5Fclose(file) < 0) TEST_ERROR + if(f > 0) + HDclose(f); return -1; } @@ -1017,15 +1052,15 @@ test_conv_buffer(hid_t fid) /* Populate the data members */ for(j = 0; j < DIM1; j++) - for(k = 0; k < DIM2; k++) - for(l = 0; l < DIM3; l++) - cf->a[j][k][l] = 10*(j+1) + l + k; + for(k = 0; k < DIM2; k++) + for(l = 0; l < DIM3; l++) + cf->a[j][k][l] = 10*(j+1) + l + k; for(j = 0; j < DIM2; j++) - cf->b[j] = (float)(100.0f*(j+1) + 0.01f*j); + cf->b[j] = 100.0f * (float)(j+1) + 0.01f * (float)j; for(j = 0; j < DIM3; j++) - cf->c[j] = 100.0f*(j+1) + 0.02f*j; + cf->c[j] = 100.0f * (float)(j+1) + 0.02f * (float)j; /* Create data space */ @@ -1102,7 +1137,7 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); puts(" PASSED"); - return(0); + return 0; error: return -1; @@ -2692,7 +2727,8 @@ test_nbit_int(hid_t file) int new_data[2][5]; unsigned int mask; size_t precision, offset; - size_t i, j; + double power; + size_t i, j; puts("Testing nbit filter"); TESTING(" nbit int (setup)"); @@ -2725,8 +2761,8 @@ test_nbit_int(hid_t file) /* Initialize data, assuming size of long long >= size of int */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (int)(((long long)HDrandom() % - (long long)HDpow(2.0f, (double)(precision - 1))) << offset); + power = HDpow(2.0f, (double)(precision - 1)); + orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -3052,7 +3088,8 @@ test_nbit_array(hid_t file) unsigned int orig_data[2][5][3][2]; unsigned int new_data[2][5][3][2]; size_t precision, offset; - size_t i, j, m, n; + double power; + size_t i, j, m, n; TESTING(" nbit array (setup)"); @@ -3091,9 +3128,11 @@ test_nbit_array(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) for(m = 0; m < (size_t)adims[0]; m++) - for(n = 0; n < (size_t)adims[1]; n++) + for(n = 0; n < (size_t)adims[1]; n++) { + power = HDpow(2.0F, (double)precision); orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)precision)) << offset); + (long long)power) << offset); + } /* end for */ PASSED(); /*---------------------------------------------------------------------- @@ -3192,7 +3231,8 @@ test_nbit_compound(hid_t file) atomic orig_data[2][5]; atomic new_data[2][5]; unsigned int i_mask, s_mask, c_mask; - size_t i, j; + double power; + size_t i, j; TESTING(" nbit compound (setup)"); @@ -3251,12 +3291,12 @@ test_nbit_compound(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j].i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); + power = HDpow(2.0F, (double)(precision[0]-1)); + orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); + power = HDpow(2.0F, (double)(precision[1]-1)); + orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + power = HDpow(2.0F, (double)(precision[2]-1)); + orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].f = float_val[i][j]; /* some even-numbered integer values are negtive */ @@ -3386,7 +3426,8 @@ test_nbit_compound_2(hid_t file) complex orig_data[2][5]; complex new_data[2][5]; unsigned int i_mask, s_mask, c_mask, b_mask; - size_t i, j, m, n, b_failed, d_failed; + double power; + size_t i, j, m, n, b_failed, d_failed; TESTING(" nbit compound complex (setup)"); @@ -3477,33 +3518,34 @@ test_nbit_compound_2(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j].a.i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].a.c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].a.s = (short)(-((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); + power = HDpow(2.0F, (double)(precision[0]-1)); + orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); + power = HDpow(2.0F, (double)(precision[1]-1)); + orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + power = HDpow(2.0F, (double)(precision[2]-1)); + orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].a.f = float_val[i][j]; - orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)precision[3])) << offset[3]); + power = HDpow(2.0F, (double)precision[3]); + orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); for(m = 0; m < (size_t)array_dims[0]; m++) - for(n = 0; n < (size_t)array_dims[1]; n++) - orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[4]-1))) << offset[4]); + for(n = 0; n < (size_t)array_dims[1]; n++) { + power = HDpow(2.0F, (double)(precision[4]-1)); + orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); + } /* end for */ for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) { - orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); + power = HDpow(2.0F, (double)(precision[0]-1)); + orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]); + power = HDpow(2.0F, (double)(precision[1]-1)); + orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); + power = HDpow(2.0F, (double)(precision[2]-1)); + orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; - } - } + } /* end for */ + } /* end for */ PASSED(); @@ -3648,7 +3690,8 @@ test_nbit_compound_3(hid_t file) const hsize_t chunk_size[1] = {5}; atomic orig_data[5]; atomic new_data[5]; - size_t i, k, j; + double power; + size_t i, k, j; TESTING(" nbit compound with no-op type (setup)"); @@ -3695,8 +3738,9 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for(i = 0; i < (size_t)size[0]; i++) { + power = HDpow(2.0F, 17.0F - 1.0F); HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); - orig_data[i].i = HDrandom() % (long)HDpow(2.0F, 17.0F - 1.0F); + orig_data[i].i = HDrandom() % (long)power; HDstrcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = HDstrdup("variable-length C string"); @@ -3815,6 +3859,7 @@ test_nbit_int_size(hid_t file) hsize_t dims[2], chunk_size[2]; hsize_t dset_size = 0; int orig_data[DSET_DIM1][DSET_DIM2]; + double power; int i, j; size_t precision, offset; @@ -3865,8 +3910,10 @@ test_nbit_int_size(hid_t file) * corresponding to the memory datatype's precision and offset. */ for (i=0; i < DSET_DIM1; i++) - for (j=0; j < DSET_DIM2; j++) - orig_data[i][j] = rand() % (int)pow((double)2, (double)(precision-1)) << offset; + for (j=0; j < DSET_DIM2; j++) { + power = HDpow(2.0F, (double)(precision-1)); + orig_data[i][j] = HDrandom() % (int)power << offset; + } /* end for */ /* Describe the dataspace. */ diff --git a/test/dt_arith.c b/test/dt_arith.c index eb201d0..76ad0f3 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -45,7 +45,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -645,11 +645,18 @@ test_hard_query(void) } PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 1; } @@ -871,7 +878,11 @@ error: if(saved_buf2) HDfree(saved_buf2); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1290,6 +1301,10 @@ test_derived_flt(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1305,7 +1320,12 @@ test_derived_flt(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1592,6 +1612,10 @@ test_derived_integer(void) HDfree(saved_buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1606,7 +1630,12 @@ test_derived_integer(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -2601,7 +2630,12 @@ done: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return (int)fails_all_tests; error: @@ -2609,7 +2643,12 @@ error: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_all_tests, 1); } @@ -2820,7 +2859,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) #endif unsigned char *hw=NULL; /*ptr to hardware-conv'd*/ int underflow; /*underflow occurred */ - int overflow; /*overflow occurred */ + int overflow = 0; /*overflow occurred */ int uflow=0; /*underflow debug counters*/ size_t j, k; /*counters */ int sendian; /* source type endianess */ @@ -3307,6 +3346,9 @@ done: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* If the source is normalized values, treat the failures as error; @@ -3330,7 +3372,11 @@ error: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + if(run_test==TEST_NOOP || run_test==TEST_NORMAL) return MAX((int)fails_all_tests, 1); else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) @@ -4504,6 +4550,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ /* If the source is normalized floating values, treat the failures as error; @@ -4518,6 +4567,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ if(run_test==TEST_NORMAL) @@ -5164,6 +5217,10 @@ main(void) *---------------------------------------------------------------------- */ without_hardware_g = TRUE; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* Test software floating-point conversion functions */ @@ -5179,8 +5236,14 @@ main(void) /* Test software integer-float conversion functions */ nerrors += run_int_fp_conv("soft"); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + if (nerrors) { printf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); @@ -5189,3 +5252,4 @@ main(void) printf("All data type tests passed.\n"); return 0; } + diff --git a/test/dtransform.c b/test/dtransform.c index 4adbaf5..2769771 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -467,7 +467,7 @@ test_poly(const hid_t dxpl_id_polynomial) for(row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) { windchillC = (int) ((5.0f / 9.0f) * (windchillFfloat[row][col] - 32)); - polyflres[row][col] = (float) ((2.0f + windchillC) * ((windchillC - 8.0f) / 2.0f)); + polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f)); } TESTING("data transform, polynomial transform (int->float)") diff --git a/test/dtypes.c b/test/dtypes.c index 88bbce0..6fe455d 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -47,7 +47,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -769,11 +769,20 @@ test_compound_2(void) CHECK_NMEMBS(nmembs , st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -888,11 +897,19 @@ test_compound_3(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1015,11 +1032,19 @@ test_compound_4(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1226,11 +1251,19 @@ test_compound_6(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1365,11 +1398,19 @@ test_compound_7(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4229,6 +4270,10 @@ test_conv_str_1(void) HDfree(buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; @@ -4241,7 +4286,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4304,7 +4353,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4418,7 +4471,11 @@ error: if(tag) H5free_memory(tag); /* Technically allocated by API call */ + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; /* Number of errors */ } @@ -4490,7 +4547,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4657,13 +4718,22 @@ test_conv_bitfield(void) H5Tclose(st); H5Tclose(dt); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: H5Tclose(st); H5Tclose(dt); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4781,14 +4851,18 @@ test_bitfield_funcs(void) retval = 0; - error: - +error: if (retval == -1) retval = 1; H5free_memory(tag); H5Tclose(ntype); H5Tclose(type); if (retval == 0) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return retval; } @@ -7293,6 +7367,7 @@ main(void) #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + h5_cleanup(FILENAME, fapl); /*must happen before first reset*/ reset_hdf5(); diff --git a/test/earray.c b/test/earray.c index b510992..368ee42 100644 --- a/test/earray.c +++ b/test/earray.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5EA package. * This file also needs to access the extensible array testing code. */ -#define H5EA_PACKAGE +#define H5EA_FRIEND /*suppress error about including H5EApkg */ #define H5EA_TESTING #include "H5EApkg.h" /* Extensible Arrays */ @@ -18,7 +18,7 @@ #include "h5test.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5Iprivate.h" @@ -3200,7 +3200,7 @@ main(void) puts("All external file cache tests passed."); - h5_cleanup(FILENAME, fapl_id); + h5_clean_files(FILENAME, fapl_id); return 0; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 4832767..4f0147e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -122,10 +122,18 @@ main(void) printf("Encode/Decode DCPLs\n"); /******* ENCODE/DECODE DCPLS *****/ - TESTING("DCPL Encoding/Decoding"); + TESTING("Default DCPL Encoding/Decoding"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(dcpl) < 0) + FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DCPL Encoding/Decoding"); + if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0) FAIL_STACK_ERROR @@ -161,10 +169,18 @@ main(void) /******* ENCODE/DECODE DAPLS *****/ - TESTING("DAPL Encoding/Decoding"); + TESTING("Default DAPL Encoding/Decoding"); if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(dapl) < 0) + FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DAPL Encoding/Decoding"); + if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0) FAIL_STACK_ERROR @@ -180,10 +196,18 @@ main(void) /******* ENCODE/DECODE OCPLS *****/ - TESTING("OCPL Encoding/Decoding"); + TESTING("Default OCPL Encoding/Decoding"); if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(ocpl) < 0) + FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("OCPL Encoding/Decoding"); + if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) FAIL_STACK_ERROR @@ -205,9 +229,18 @@ main(void) /******* ENCODE/DECODE DXPLS *****/ - TESTING("DXPL Encoding/Decoding"); + TESTING("Default DXPL Encoding/Decoding"); if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) FAIL_STACK_ERROR + + /* Test encoding & decoding default property list */ + if(test_encode_decode(dxpl) < 0) + FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DXPL Encoding/Decoding"); + if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0) FAIL_STACK_ERROR if((H5Pset_hyper_vector_size(dxpl, 5)) < 0) @@ -241,10 +274,18 @@ main(void) /******* ENCODE/DECODE GCPLS *****/ - TESTING("GCPL Encoding/Decoding"); + TESTING("Default GCPL Encoding/Decoding"); if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(gcpl) < 0) + FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("GCPL Encoding/Decoding"); + if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0) FAIL_STACK_ERROR @@ -273,10 +314,18 @@ main(void) /******* ENCODE/DECODE LCPLS *****/ - TESTING("LCPL Encoding/Decoding"); + TESTING("Default LCPL Encoding/Decoding"); if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(lcpl) < 0) + FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("LCPL Encoding/Decoding"); + if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0) FAIL_STACK_ERROR @@ -292,10 +341,18 @@ main(void) /******* ENCODE/DECODE LAPLS *****/ - TESTING("LAPL Encoding/Decoding"); + TESTING("Default LAPL Encoding/Decoding"); if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(lapl) < 0) + FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("LAPL Encoding/Decoding"); + if((H5Pset_nlinks(lapl, (size_t)134)) < 0) FAIL_STACK_ERROR @@ -330,10 +387,18 @@ main(void) /******* ENCODE/DECODE OCPYPLS *****/ - TESTING("OCPYPL Encoding/Decoding"); + TESTING("Default OCPYPL Encoding/Decoding"); if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(ocpypl) < 0) + FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n") + + PASSED(); + + TESTING("OCPYPL Encoding/Decoding"); + if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0) FAIL_STACK_ERROR @@ -354,10 +419,18 @@ main(void) /******* ENCODE/DECODE FAPLS *****/ - TESTING("FAPL Encoding/Decoding"); + TESTING("Default FAPL Encoding/Decoding"); if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(fapl) < 0) + FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("FAPL Encoding/Decoding"); + if((H5Pset_family_offset(fapl, 1024)) < 0) FAIL_STACK_ERROR if((H5Pset_meta_block_size(fapl, 2098452)) < 0) @@ -397,11 +470,19 @@ main(void) /******* ENCODE/DECODE FCPLS *****/ - TESTING("FCPL Encoding/Decoding"); + TESTING("Default FCPL Encoding/Decoding"); if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(fcpl) < 0) + FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("FCPL Encoding/Decoding"); + if((H5Pset_userblock(fcpl, 1024) < 0)) FAIL_STACK_ERROR @@ -435,11 +516,19 @@ main(void) /******* ENCODE/DECODE STRCPLS *****/ - TESTING("STRCPL Encoding/Decoding"); + TESTING("Default STRCPL Encoding/Decoding"); if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(strcpl) < 0) + FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("STRCPL Encoding/Decoding"); + if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0)) FAIL_STACK_ERROR @@ -455,11 +544,19 @@ main(void) /******* ENCODE/DECODE ACPLS *****/ - TESTING("ACPL Encoding/Decoding"); + TESTING("Default ACPL Encoding/Decoding"); if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(acpl) < 0) + FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n") + + PASSED(); + + TESTING("ACPL Encoding/Decoding"); + if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)) FAIL_STACK_ERROR diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c new file mode 100644 index 0000000..a5d5552 --- /dev/null +++ b/test/enc_dec_plist_cross_platform.c @@ -0,0 +1,235 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Serial tests for encoding/decoding plists + */ + +#include "h5test.h" +#include "H5srcdir.h" + +#define CONFIG_LE 0x01 +#define CONFIG_64 0x02 +#define NCONFIG 0x04 + +static int test_plists(const char *filename_prefix); + +int +main(void) +{ + if(VERBOSE_MED) + printf("Encode/Decode property list endianess\n"); + + /******* ENCODE/DECODE DCPLS *****/ + TESTING("Default DCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_dcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("DCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE DAPLS *****/ + TESTING("Default DAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_dapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("DAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE DXPLS *****/ + TESTING("Default DXPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_dxpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("DXPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dxpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE GCPLS *****/ + TESTING("Default GCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_gcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("GCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/gcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE LCPLS *****/ + TESTING("Default LCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_lcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("LCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/lcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE LAPLS *****/ + TESTING("Default LAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_lapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("LAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/lapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE OCPLS *****/ + TESTING("Default OCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_ocpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("OCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/ocpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE OCPYPLS *****/ + TESTING("Default OCPYPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_ocpypl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("OCPYPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/ocpypl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE FCPLS *****/ + TESTING("Default FCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_fcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("FCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/fcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE FAPLS *****/ + TESTING("Default FAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_fapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("FAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/fapl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE STRCPLS *****/ + TESTING("Default STRCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_strcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("STRCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/strcpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE ACPLS *****/ + TESTING("Default ACPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/def_acpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + TESTING("ACPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/acpl_") < 0) + FAIL_STACK_ERROR + PASSED(); + + return 0; + +error: + return 1; +} + +static int +test_plists(const char *filename_prefix) +{ + unsigned config_1, config_2; + int fd_1, fd_2; + size_t size_1 = 0, size_2 = 0; + void *buf_1 = NULL, *buf_2 = NULL; + hid_t plist_1, plist_2; + char filename[1024]; + const char *testfile; + + /* Iterate over all combinations of configurations */ + for(config_1 = 0; config_1 < (NCONFIG - 1); config_1++) + for(config_2 = config_1 + 1; config_2 < NCONFIG; config_2++) { + /* Generate filename for file 1 */ + if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix, + config_1 & CONFIG_64 ? "64" : "32", + config_1 & CONFIG_LE ? "le" : "be") < 0) + TEST_ERROR + + /* Read file 1 */ + testfile = H5_get_srcdir_filename(filename); + if((fd_1 = HDopen(testfile, O_RDONLY, 0666)) < 0) + TEST_ERROR + size_1 = (size_t)HDlseek(fd_1, (HDoff_t)0, SEEK_END); + HDlseek(fd_1, (HDoff_t)0, SEEK_SET); + buf_1 = (void *)HDmalloc(size_1); + if(HDread(fd_1, buf_1, size_1) < 0) + TEST_ERROR + HDclose(fd_1); + + /* Generate filename for file 2 */ + if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix, + config_2 & CONFIG_64 ? "64" : "32", + config_2 & CONFIG_LE ? "le" : "be") < 0) + TEST_ERROR + + /* Read file 1 */ + testfile = H5_get_srcdir_filename(filename); + if((fd_2 = HDopen(testfile, O_RDONLY, 0666)) < 0) + TEST_ERROR + size_2 = (size_t)HDlseek(fd_2, (HDoff_t)0, SEEK_END); + HDlseek(fd_2, (HDoff_t)0, SEEK_SET); + buf_2 = (void *)HDmalloc(size_2); + if(HDread(fd_2, buf_2, size_2) < 0) + TEST_ERROR + HDclose(fd_2); + + /* Decode property lists */ + if((plist_1 = H5Pdecode(buf_1)) < 0) + FAIL_STACK_ERROR + if((plist_2 = H5Pdecode(buf_2)) < 0) + FAIL_STACK_ERROR + + /* Compare decoded property lists */ + if(!H5Pequal(plist_1, plist_2)) + FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n") + + /* Close */ + if((H5Pclose(plist_1)) < 0) + FAIL_STACK_ERROR + if((H5Pclose(plist_2)) < 0) + FAIL_STACK_ERROR + + HDfree(buf_1); + HDfree(buf_2); + } /* end for */ + + return 1; + +error: + printf("***** Plist Encode/Decode tests FAILED! *****\n"); + return -1; +} + diff --git a/test/enc_dec_plist_with_endianess.c b/test/enc_dec_plist_with_endianess.c deleted file mode 100644 index 4469604..0000000 --- a/test/enc_dec_plist_with_endianess.c +++ /dev/null @@ -1,160 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Serial tests for encoding/decoding plists - */ - -#include "h5test.h" -#include "H5srcdir.h" - -static int test_plists(const char *filename1, const char *filename2); - -int -main(void) -{ - if(VERBOSE_MED) - printf("Encode/Decode property list endianess\n"); - - /******* ENCODE/DECODE DCPLS *****/ - TESTING("DCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE DAPLS *****/ - TESTING("DAPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE DXPLS *****/ - TESTING("DXPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE GCPLS *****/ - TESTING("GCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE LCPLS *****/ - TESTING("LCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE LAPLS *****/ - TESTING("LAPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE OCPLS *****/ - TESTING("OCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE OCPYPLS *****/ - TESTING("OCPYPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE FCPLS *****/ - TESTING("FCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE FAPLS *****/ - TESTING("FAPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE STRCPLS *****/ - TESTING("STRCPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - /******* ENCODE/DECODE ACPLS *****/ - TESTING("ACPL Encoding/Decoding"); - if(test_plists("testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be") < 0) - FAIL_STACK_ERROR - PASSED(); - - return 0; - -error: - return 1; -} - -static int -test_plists(const char *filename1, const char *filename2) -{ - int fd_le, fd_be; - size_t size_le = 0, size_be = 0; - void *buf_le = NULL, *buf_be = NULL; - hid_t plist_le, plist_be; /* dataset create prop. list */ - const char *testfile; - - testfile = H5_get_srcdir_filename(filename1); - if((fd_le = HDopen(testfile, O_RDONLY, 0666)) < 0) - TEST_ERROR - size_le = HDlseek(fd_le, (HDoff_t)0, SEEK_END); - HDlseek(fd_le, (HDoff_t)0, SEEK_SET); - buf_le = (void *)HDmalloc(size_le); - if(HDread(fd_le, buf_le, size_le) < 0) - TEST_ERROR - HDclose(fd_le); - - testfile = H5_get_srcdir_filename(filename2); - if((fd_be = HDopen(testfile, O_RDONLY, 0666)) < 0) - TEST_ERROR - size_be = HDlseek(fd_be, (HDoff_t)0, SEEK_END); - HDlseek(fd_be, (HDoff_t)0, SEEK_SET); - buf_be = (void *)HDmalloc(size_be); - if(HDread(fd_be, buf_be, size_be) < 0) - TEST_ERROR - HDclose(fd_be); - - if((plist_le = H5Pdecode(buf_le)) < 0) - FAIL_STACK_ERROR - if((plist_be = H5Pdecode(buf_be)) < 0) - FAIL_STACK_ERROR - - if(!H5Pequal(plist_le, plist_be)) - FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n") - - if((H5Pclose(plist_le)) < 0) - FAIL_STACK_ERROR - if((H5Pclose(plist_be)) < 0) - FAIL_STACK_ERROR - - HDfree(buf_le); - HDfree(buf_be); - - return 1; - -error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); - return -1; -} - diff --git a/test/err_compat.c b/test/err_compat.c index 576433e..7779ddc 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -500,7 +500,7 @@ main(void) } if(H5Fclose(file) < 0) TEST_ERROR ; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); printf("All error API tests passed.\n"); return 0; @@ -510,3 +510,4 @@ main(void) return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/test/error_test.c b/test/error_test.c index e712d86..4e4c0ef 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -756,7 +756,7 @@ main(void) if(test_filter_error(filename) < 0) TEST_ERROR; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfprintf(stderr, "\nAll error API tests passed.\n"); return 0; diff --git a/test/farray.c b/test/farray.c index 43b63c6..e3e59da 100644 --- a/test/farray.c +++ b/test/farray.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5FA package. * This file also needs to access the fixed array testing code. */ -#define H5FA_PACKAGE +#define H5FA_FRIEND /*suppress error about including H5FApkg */ #define H5FA_TESTING #include "H5FApkg.h" /* Fixed Arrays */ diff --git a/test/fheap.c b/test/fheap.c index bb30e05..25784a9 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5HF package. * This file also needs to access the fractal heap testing code. */ -#define H5HF_PACKAGE +#define H5HF_FRIEND /*suppress error about including H5HFpkg */ #define H5HF_TESTING #include "H5HFpkg.h" /* Fractal heaps */ diff --git a/test/file_image.c b/test/file_image.c index b1b9d47..d9c782a 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -643,7 +643,7 @@ test_core(void) if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Release resources */ - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfree(udata); HDfree(file_image); HDremove(copied_filename); @@ -890,8 +890,7 @@ test_get_file_image(const char * test_banner, VERIFY(err == SUCCEED, "H5Pclose(core_fapl_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl); - VERIFY(result != 0, "h5_cleanup() failed."); + h5_clean_files(FILENAME2, fapl); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1039,8 +1038,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(file_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(1) failed."); + h5_clean_files(FILENAME2, fapl_id); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1145,8 +1143,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); /************************** Test #3 **********************************/ /* set up a split file driver test file, and try to get its image @@ -1208,8 +1205,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); /************************** Test #4 **********************************/ /* set up a family file driver test file, and try to get its image @@ -1269,8 +1265,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); PASSED(); @@ -1340,6 +1335,8 @@ main(void) errors += test_get_file_image_error_rejection(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); if(errors) { printf("***** %d File Image TEST%s FAILED! *****\n", diff --git a/test/flush2.c b/test/flush2.c index 0ee299e..e86d646 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -107,7 +107,7 @@ error: static int check_file(char* filename, hid_t fapl, int flag) { - hid_t file, groups, grp; + hid_t file = -1, groups = -1; char name[1024]; int i; @@ -117,6 +117,7 @@ check_file(char* filename, hid_t fapl, int flag) /* Open some groups */ if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; for(i = 0; i < 100; i++) { + hid_t grp; sprintf(name, "grp%02u", (unsigned)i); if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; if(H5Gclose(grp) < 0) goto error; @@ -132,6 +133,11 @@ check_file(char* filename, hid_t fapl, int flag) return 0; error: + H5E_BEGIN_TRY { + H5Gclose(groups); + H5Fclose(file); + } H5E_END_TRY; + return 1; } /* end check_file() */ @@ -184,14 +190,13 @@ main(void) h5_fixname(FILENAME[1], fapl, name, sizeof name); if(check_file(name, fapl, FALSE)) PASSED() - else - { + else { #if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS) - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif } H5Eset_auto2(H5E_DEFAULT, func, NULL); @@ -205,17 +210,16 @@ main(void) h5_fixname(FILENAME[2], fapl, name, sizeof name); if(check_file(name, fapl, TRUE)) PASSED() - else - { + else { #if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS) - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif - } + H5Eset_auto2(H5E_DEFAULT, func, NULL); h5_cleanup(FILENAME, fapl); diff --git a/test/freespace.c b/test/freespace.c index 1338ae7..1b87974 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -17,13 +17,13 @@ */ #include "h5test.h" -#define H5FS_PACKAGE +#define H5FS_FRIEND /*suppress error about including H5FSpkg */ #define H5FS_TESTING #include "H5FSpkg.h" /* Free space manager */ /* Other private headers that this test requires */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -2841,6 +2841,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* make sure alignment is not set for tests to succeed */ diff --git a/test/gen_cross.c b/test/gen_cross.c index 2d4b788..816064d 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -100,9 +100,9 @@ int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid); int create_normal_dset(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* file and dataset handles */ - hid_t dcpl; - float data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* file and dataset handles */ + hid_t dcpl = -1; + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; int i, j; @@ -207,9 +207,9 @@ error: int create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - float data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -298,9 +298,9 @@ error: int create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - double data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + double data[NX][NY]; /* data to write */ double fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -389,9 +389,9 @@ error: int create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - char data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + char data[NX][NY]; /* data to write */ char fillvalue = -2; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -488,9 +488,9 @@ error: int create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - short data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + short data[NX][NY]; /* data to write */ short fillvalue = -2; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -587,9 +587,9 @@ error: int create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - int data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + int data[NX][NY]; /* data to write */ int fillvalue = -2; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -687,9 +687,9 @@ error: int create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - long long data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + long long data[NX][NY]; /* data to write */ long long fillvalue = -2; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -786,9 +786,9 @@ error: int create_fletcher_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - float data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -878,9 +878,9 @@ int create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { #ifdef H5_HAVE_FILTER_DEFLATE - hid_t dataset; /* dataset handles */ - hid_t dcpl; - float data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -1070,9 +1070,9 @@ error: int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t dcpl; - float data[NX][NY]; /* data to write */ + hid_t dataset = -1; /* dataset handles */ + hid_t dcpl = -1; + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; @@ -1161,11 +1161,11 @@ error: int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { - hid_t dataset; /* dataset handles */ - hid_t datatype; - hid_t dcpl; + hid_t dataset = -1; /* dataset handles */ + hid_t datatype = -1; + hid_t dcpl = -1; size_t precision, offset; - float data[NX][NY]; /* data to write */ + float data[NX][NY]; /* data to write */ float fillvalue = -2.2f; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; diff --git a/test/gen_plist.c b/test/gen_plist.c index cd3748b..f071733 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -25,7 +25,7 @@ #include "H5private.h" #include "hdf5.h" -static int encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be); +static int encode_plist(hid_t plist_id, int little_endian, int word_length, const char *filename_prefix); int main(void) @@ -54,6 +54,7 @@ main(void) unsigned min_dense; const char* c_to_f = "x+32"; int little_endian; + int word_length; H5AC_cache_config_t my_cache_config = { H5AC__CURR_CACHE_CONFIG_VERSION, 1 /*TRUE*/, @@ -63,26 +64,26 @@ main(void) 1 /*TRUE*/, 0 /*FALSE*/, ( 2 * 2048 * 1024), - 0.3, + 0.3f, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, - 0.8, - 3.0, + 0.8f, + 3.0f, 1 /*TRUE*/, (8 * 1024 * 1024), H5C_flash_incr__add_space, - 2.0, - 0.25, + 2.0f, + 0.25f, H5C_decr__age_out_with_threshold, - 0.997, - 0.8, + 0.997f, + 0.8f, 1 /*TRUE*/, (3 * 1024 * 1024), 3, 0 /*FALSE*/, - 0.2, + 0.2f, (256 * 2048), H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; @@ -99,6 +100,11 @@ main(void) little_endian = 0; } + /* check word length */ + { + word_length = 8 * sizeof(void *); + } + /* Explicitly initialize the library, since we are including the private header file */ H5open(); @@ -106,6 +112,9 @@ main(void) if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) assert(dcpl1 > 0); + if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/def_dcpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0) assert(ret > 0); @@ -131,7 +140,7 @@ main(void) (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) assert(ret > 0); - if((ret = encode_plist(dcpl1, little_endian, "testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be")) < 0) + if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/dcpl_")) < 0) assert(ret > 0); /* release resource */ @@ -143,10 +152,13 @@ main(void) if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) assert(dapl1 > 0); + if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/def_dapl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0) assert(ret > 0); - if((ret = encode_plist(dapl1, little_endian, "testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be")) < 0) + if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/dapl_")) < 0) assert(ret > 0); /* release resource */ @@ -156,6 +168,10 @@ main(void) /******* ENCODE/DECODE DXPLS *****/ if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0) assert(dxpl1 > 0); + + if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/def_dxpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0) assert(ret > 0); if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0) @@ -177,7 +193,7 @@ main(void) if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0) assert(ret > 0); - if((ret = encode_plist(dxpl1, little_endian, "testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be")) < 0) + if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/dxpl_")) < 0) assert(ret > 0); /* release resource */ @@ -189,6 +205,9 @@ main(void) if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) assert(gcpl1 > 0); + if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/def_gcpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0) assert(ret > 0); @@ -205,7 +224,7 @@ main(void) if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) assert(ret > 0); - if((ret = encode_plist(gcpl1, little_endian, "testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be")) < 0) + if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/gcpl_")) < 0) assert(ret > 0); /* release resource */ @@ -216,10 +235,13 @@ main(void) if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0) assert(lcpl1 > 0); + if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/def_lcpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0) assert(ret > 0); - if((ret = encode_plist(lcpl1, little_endian, "testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be")) < 0) + if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/lcpl_")) < 0) assert(ret > 0); /* release resource */ @@ -230,6 +252,9 @@ main(void) if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0) assert(ocpypl1 > 0); + if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/def_ocpypl_")) < 0) + assert(ret > 0); + ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG); assert(ret >= 0); @@ -239,7 +264,7 @@ main(void) ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar"); assert(ret >= 0); - if((ret = encode_plist(ocpypl1, little_endian, "testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be")) < 0) + if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/ocpypl_")) < 0) assert(ret > 0); /* release resource */ @@ -250,6 +275,9 @@ main(void) if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0) assert(ocpl1 > 0); + if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/def_ocpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) assert(ret > 0); @@ -259,7 +287,7 @@ main(void) if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0) assert(ret > 0); - if((ret = encode_plist(ocpl1, little_endian, "testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be")) < 0) + if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/ocpl_")) < 0) assert(ret > 0); /* release resource */ @@ -270,6 +298,9 @@ main(void) if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0) assert(lapl1 > 0); + if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/def_lapl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0) assert(ret > 0); @@ -292,7 +323,7 @@ main(void) if((ret = H5Pclose(fapl1)) < 0) assert(ret > 0); - if((ret = encode_plist(lapl1, little_endian, "testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be")) < 0) + if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/lapl_")) < 0) assert(ret > 0); /* release resource */ @@ -303,6 +334,9 @@ main(void) if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) assert(fapl1 > 0); + if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/def_fapl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_family_offset(fapl1, 1024)) < 0) assert(ret > 0); if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0) @@ -330,7 +364,7 @@ main(void) if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) assert(ret > 0); - if((ret = encode_plist(fapl1, little_endian, "testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be")) < 0) + if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0) assert(ret > 0); /* release resource */ @@ -341,6 +375,9 @@ main(void) if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0) assert(fcpl1 > 0); + if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/def_fcpl_")) < 0) + assert(ret > 0); + if((ret = H5Pset_userblock(fcpl1, 1024) < 0)) assert(ret > 0); @@ -362,7 +399,7 @@ main(void) if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0)) assert(ret > 0); - if((ret = encode_plist(fcpl1, little_endian, "testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be")) < 0) + if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0) assert(ret > 0); /* release resource */ @@ -373,10 +410,13 @@ main(void) strcpl1 = H5Pcreate(H5P_STRING_CREATE); assert(strcpl1 > 0); + ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/def_strcpl_"); + assert(ret > 0); + ret = H5Pset_char_encoding(strcpl1, H5T_CSET_UTF8); assert(ret >= 0); - ret = encode_plist(strcpl1, little_endian, "testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be"); + ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/strcpl_"); assert(ret > 0); /* release resource */ @@ -387,10 +427,13 @@ main(void) acpl1 = H5Pcreate(H5P_ATTRIBUTE_CREATE); assert(acpl1 > 0); + ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/def_acpl_"); + assert(ret > 0); + ret = H5Pset_char_encoding(acpl1, H5T_CSET_UTF8); assert(ret >= 0); - ret = encode_plist(acpl1, little_endian, "testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be"); + ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/acpl_"); assert(ret > 0); /* release resource */ @@ -401,13 +444,18 @@ main(void) } static int -encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be) +encode_plist(hid_t plist_id, int little_endian, int word_length, const char *filename_prefix) { int fd = 0; /* file descriptor */ herr_t ret = 0; void *temp_buf = NULL; size_t temp_size = 0; ssize_t write_size; + char filename[1024]; + + /* Generate filename */ + if((ret = HDsnprintf(filename, sizeof(filename), "%s%d%s", filename_prefix, word_length, little_endian ? "le" : "be")) < 0) + assert(ret > 0); /* first call to encode returns only the size of the buffer needed */ if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0) @@ -419,10 +467,7 @@ encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const c if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0) assert(ret > 0); - if(little_endian) - fd = HDopen(filename_le, O_RDWR | O_CREAT | O_TRUNC, 0666); - else - fd = HDopen(filename_be, O_RDWR | O_CREAT | O_TRUNC, 0666); + fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, 0666); assert(fd > 0); write_size = HDwrite(fd, temp_buf, temp_size); diff --git a/test/getname.c b/test/getname.c index e1bbc6b..2700b49 100644 --- a/test/getname.c +++ b/test/getname.c @@ -20,8 +20,8 @@ * Purpose: Tests the "ID to name" functionality */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5I_FRIEND /*suppress error about including H5Ipkg */ /* Define these macros to indicate that the testing APIs should be available */ #define H5G_TESTING diff --git a/test/h5test.c b/test/h5test.c index aa99c1f..f16b98f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -28,7 +28,7 @@ #include "H5srcdir.h" /* Necessary for h5_verify_cached_stabs() */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "H5Gpkg.h" @@ -91,6 +91,9 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; +/* Previous error reporting function */ +static H5E_auto2_t err_func = NULL; + static herr_t h5_errors(hid_t estack, void *client_data); static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, char *fullname, size_t size, hbool_t nest_printf); @@ -122,7 +125,7 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) /*------------------------------------------------------------------------- - * Function: h5_cleanup_files + * Function: h5_clean_files * * Purpose: Cleanup temporary test files (always). * base_name contains the list of test file names. @@ -131,13 +134,11 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) * * Programmer: Neil Fortner * June 1, 2015 - * Original: Albert Cheng - * May 28, 1998 * *------------------------------------------------------------------------- */ void -h5_cleanup_files(const char *base_name[], hid_t fapl) +h5_clean_files(const char *base_name[], hid_t fapl) { int i; @@ -184,8 +185,11 @@ h5_cleanup_files(const char *base_name[], hid_t fapl) } } /* end for */ + /* Close the FAPL used to access the file */ + H5Pclose(fapl); + return; -} /* end h5_cleanup_files() */ +} /* end h5_clean_files() */ /*------------------------------------------------------------------------- @@ -208,14 +212,38 @@ h5_cleanup(const char *base_name[], hid_t fapl) int retval = 0; if(GetTestCleanup()) { - /* Clean up files in base_name */ - h5_cleanup_files(base_name, fapl); + /* Clean up files in base_name, and the FAPL */ + h5_clean_files(base_name, fapl); retval = 1; } /* end if */ - H5Pclose(fapl); + /* Restore the original error reporting routine */ + h5_restore_err(); + return retval; +} /* end h5_cleanup() */ + + +/*------------------------------------------------------------------------- + * Function: h5_restore_err + * + * Purpose: Restore the default error handler. + * + * Return: N/A + * + * Programmer: Quincey Koziol + * Sept 10, 2015 + * + *------------------------------------------------------------------------- + */ +void +h5_restore_err(void) +{ + /* Restore the original error reporting routine */ + HDassert(err_func != NULL); + H5Eset_auto2(H5E_DEFAULT, err_func, NULL); + err_func = NULL; } @@ -237,6 +265,10 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* @@ -258,12 +290,12 @@ h5_reset(void) */ sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); + hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(grp); + H5Fclose(file); + HDunlink(filename); } H5E_END_TRY; } #endif /* OLD_WAY */ diff --git a/test/h5test.h b/test/h5test.h index 9d097af..ca0eead 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -123,8 +123,8 @@ extern "C" { #endif /* Generally useful testing routines */ +H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl); H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); -H5TEST_DLL void h5_cleanup_files(const char *base_name[], hid_t fapl); H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size); @@ -132,6 +132,7 @@ H5TEST_DLL hid_t h5_fileaccess(void); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); +H5TEST_DLL void h5_restore_err(void); 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, ...); diff --git a/test/istore.c b/test/istore.c index d088fe8..ec7542a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -19,7 +19,7 @@ * Purpose: Tests various aspects of indexed raw data storage. */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "h5test.h" #include "H5private.h" diff --git a/test/links.c b/test/links.c index ef71be7..577834d 100644 --- a/test/links.c +++ b/test/links.c @@ -24,7 +24,7 @@ * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" @@ -3883,11 +3883,8 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR if(H5Pclose(lapl_id) < 0) TEST_ERROR - /* Try closing out_fapl should fail since H5Pclose(lapl_id) should also close its fapl */ - H5E_BEGIN_TRY { - ret = H5Pclose(out_fapl); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR /* Verify that the driver for the copied link's fapl is the "core" driver */ if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR @@ -3897,11 +3894,8 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR - /* Try closing out_fapl should fail since the property is removed from new_lapl_id */ - H5E_BEGIN_TRY { - ret = H5Pclose(out_fapl); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR if(H5Pclose(l_fapl) < 0) TEST_ERROR if(H5Pclose(new_lapl_id) < 0) TEST_ERROR @@ -6240,7 +6234,7 @@ error: static int external_link_strong(hid_t fapl, hbool_t new_format) { - hid_t my_fapl; /* File access property list */ + hid_t my_fapl = (-1); /* File access property list */ hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -6289,11 +6283,15 @@ external_link_strong(hid_t fapl, hbool_t new_format) if(H5Gclose(gid2) < 0) TEST_ERROR if(H5Fclose(fid2) < 0) TEST_ERROR + /* Close fapl */ + if(H5Pclose(my_fapl) < 0) TEST_ERROR + PASSED(); return 0; error: H5E_BEGIN_TRY { + H5Pclose(my_fapl); H5Gclose(fapl); H5Gclose(gid2); H5Gclose(gid1); diff --git a/test/links_env.c b/test/links_env.c index 6e47667..b3fec38 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -17,7 +17,7 @@ * Purpose: Tests hard, soft (symbolic) & external links. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" @@ -24,13 +24,13 @@ #include "h5test.h" -#define H5MF_PACKAGE +#define H5MF_FRIEND /*suppress error about including H5MFpkg */ #include "H5MFpkg.h" -#define H5FS_PACKAGE +#define H5FS_FRIEND /*suppress error about including H5FSpkg */ #include "H5FSpkg.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" @@ -331,9 +331,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ - h5_stat_size_t file_size, new_file_size; /* file size */ + h5_stat_size_t file_size = 0, new_file_size; /* file size */ H5FD_mem_t type; - haddr_t addr; + haddr_t addr = 0; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -3236,7 +3236,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) hid_t file = -1; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ - h5_stat_size_t empty_size, file_size; + h5_stat_size_t empty_size = 0, file_size; H5FD_mem_t type, stype; haddr_t new_addr, addr, saddr; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; @@ -3528,7 +3528,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) hid_t file = -1; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ - h5_stat_size_t empty_size, file_size; + h5_stat_size_t empty_size = 0, file_size; H5FD_mem_t type, stype; haddr_t addr1, addr2, addr3, saddr1; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; @@ -3764,7 +3764,7 @@ static unsigned test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { hid_t file = -1; /* File ID */ - hid_t fapl1; + hid_t fapl1 = -1; char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; @@ -6843,7 +6843,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* STDIO */ @@ -6857,7 +6857,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* CORE */ HDputs("Testing free-space managers with core driver"); @@ -6871,7 +6871,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* FAMILY */ HDputs("Testing free-space managers with family driver"); @@ -6883,7 +6883,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* SPLIT */ HDputs("Testing free-space managers with split driver"); @@ -6896,7 +6896,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_persist(fapl_new, fcpl); ret += test_mf_fs_split(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* MULTI */ HDputs("Testing free-space managers with multi driver"); @@ -6910,7 +6910,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_multi(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); } /* end for new_format */ @@ -7262,7 +7262,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* STDIO */ HDputs("Testing file space management with stdio driver"); @@ -7275,7 +7275,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* CORE */ HDputs("Testing file space management with core driver"); @@ -7289,7 +7289,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* FAMILY */ HDputs("Testing file space managers with family driver"); @@ -7302,7 +7302,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* SPLIT */ @@ -7316,7 +7316,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* MULTI */ HDputs("Testing file space managers with multi driver"); @@ -7331,7 +7331,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); } /* end for new_format */ @@ -7456,6 +7456,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* Make a copy of the FAPL before adjusting the alignment */ diff --git a/test/objcopy.c b/test/objcopy.c index a73beb3..ecc3ba5 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -28,7 +28,7 @@ * This file needs to access private information from the H5S package. * This file also needs to access the dataspace testing code. */ -#define H5S_PACKAGE +#define H5S_FRIEND /*suppress error about including H5Spkg */ #define H5S_TESTING #include "H5Spkg.h" /* Dataspaces */ @@ -36,7 +36,7 @@ * This file needs to access private information from the H5P package. * This file also needs to access the property list testing code. */ -#define H5P_PACKAGE +#define H5P_FRIEND /*suppress error about including H5Ppkg */ #define H5P_TESTING #include "H5Ppkg.h" /* Property Lists */ @@ -1247,10 +1247,6 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) } /* Remove external file information from the dcpls */ - /* Remove default property causes memory leak - if(H5Premove(dcpl, H5D_CRT_EXT_FILE_LIST_NAME) < 0) TEST_ERROR - if(H5Premove(dcpl2, H5D_CRT_EXT_FILE_LIST_NAME) < 0) TEST_ERROR - */ /* reset external file information from the dcpls */ if (H5P_reset_external_file_test(dcpl) < 0) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index 45f2238..e178729 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -24,14 +24,14 @@ * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_PACKAGE +#define H5O_FRIEND /*suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5Gpkg.h" const char *FILENAME[] = { diff --git a/test/plugin.c b/test/plugin.c index 74a8f4b..e34c691 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -26,7 +26,7 @@ /* * This file needs to access private datatypes from the H5Z package. */ -#define H5Z_PACKAGE +#define H5Z_FRIEND #include "H5Zpkg.h" /* Filters for HDF5 internal test */ @@ -768,6 +768,9 @@ main(void) if(H5Pclose(fapl2) < 0) TEST_ERROR if(H5Pclose(fapl) < 0) TEST_ERROR + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + puts("\nTesting reading data with with dynamic plugin filters:"); /* Close the library so that all loaded plugin libraries are unloaded */ @@ -784,6 +787,9 @@ main(void) /* Open the groups with filters */ nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + /* Close the library so that all loaded plugin libraries are unloaded */ h5_reset(); fapl = h5_fileaccess(); diff --git a/test/pool.c b/test/pool.c index 916d45e..83c862b 100644 --- a/test/pool.c +++ b/test/pool.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5MP package. * This file also needs to access the memory pool testing code. */ -#define H5MP_PACKAGE +#define H5MP_FRIEND /*suppress error about including H5MPpkg */ #define H5MP_TESTING #include "H5MPpkg.h" /* Memory Pools */ diff --git a/test/stab.c b/test/stab.c index 95e9722..7db1feb 100644 --- a/test/stab.c +++ b/test/stab.c @@ -18,7 +18,7 @@ * Tuesday, November 24, 1998 */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING diff --git a/test/tattr.c b/test/tattr.c index 6642cf1..d96ca59 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -29,7 +29,7 @@ * This file needs to access private information from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_PACKAGE +#define H5O_FRIEND /*suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* Object headers */ @@ -37,7 +37,7 @@ * This file needs to access private information from the H5A package. * This file also needs to access the attribute testing code. */ -#define H5A_PACKAGE +#define H5A_FRIEND /*suppress error about including H5Apkg */ #define H5A_TESTING #include "H5Apkg.h" /* Attributes */ @@ -45,7 +45,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -846,7 +846,7 @@ test_attr_compound_read(hid_t fapl) t_class = H5Tget_class(field); VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order = H5Tget_order(field); - VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(field); VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size"); H5Tclose(field); @@ -855,7 +855,7 @@ test_attr_compound_read(hid_t fapl) t_class = H5Tget_class(field); VERIFY(t_class, H5T_FLOAT, "H5Tget_class"); order = H5Tget_order(field); - VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_DOUBLE), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(field); VERIFY(size, H5Tget_size(H5T_NATIVE_DOUBLE), "H5Tget_size"); H5Tclose(field); @@ -864,7 +864,7 @@ test_attr_compound_read(hid_t fapl) t_class = H5Tget_class(field); VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order = H5Tget_order(field); - VERIFY(order, H5Tget_order(H5T_NATIVE_SCHAR), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_SCHAR), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(field); VERIFY(size, H5Tget_size(H5T_NATIVE_SCHAR), "H5Tget_size"); H5Tclose(field); @@ -1229,7 +1229,7 @@ test_attr_mult_read(hid_t fapl) t_class = H5Tget_class(type); VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order = H5Tget_order(type); - VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(type); VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size"); H5Tclose(type); @@ -1284,7 +1284,7 @@ test_attr_mult_read(hid_t fapl) t_class = H5Tget_class(type); VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order = H5Tget_order(type); - VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(type); VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size"); H5Tclose(type); @@ -1342,7 +1342,7 @@ test_attr_mult_read(hid_t fapl) t_class = H5Tget_class(type); VERIFY(t_class, H5T_FLOAT, "H5Tget_class"); order = H5Tget_order(type); - VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order"); + VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_DOUBLE), H5T_order_t, "%d", "H5Tget_order"); size = H5Tget_size(type); VERIFY(size, H5Tget_size(H5T_NATIVE_DOUBLE), "H5Tget_size"); H5Tclose(type); diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in index a6d8c50..43e76c4 100644 --- a/test/test_plugin.sh.in +++ b/test/test_plugin.sh.in @@ -36,7 +36,7 @@ case $(uname) in *) PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*" PLUGIN_LIB2="$FROM_DIR/libdynlib2.*" - :: + ;; esac PLUGIN_LIBDIR1=testdir1 PLUGIN_LIBDIR2=testdir2 diff --git a/test/testfiles/plist_files/acpl_le b/test/testfiles/plist_files/acpl_32be Binary files differindex ba342d9..ba342d9 100644 --- a/test/testfiles/plist_files/acpl_le +++ b/test/testfiles/plist_files/acpl_32be diff --git a/test/testfiles/plist_files/acpl_be b/test/testfiles/plist_files/acpl_32le Binary files differindex ba342d9..ba342d9 100644 --- a/test/testfiles/plist_files/acpl_be +++ b/test/testfiles/plist_files/acpl_32le diff --git a/test/testfiles/plist_files/acpl_64be b/test/testfiles/plist_files/acpl_64be Binary files differnew file mode 100644 index 0000000..ba342d9 --- /dev/null +++ b/test/testfiles/plist_files/acpl_64be diff --git a/test/testfiles/plist_files/acpl_64le b/test/testfiles/plist_files/acpl_64le Binary files differnew file mode 100644 index 0000000..ba342d9 --- /dev/null +++ b/test/testfiles/plist_files/acpl_64le diff --git a/test/testfiles/plist_files/dapl_le b/test/testfiles/plist_files/dapl_32be Binary files differindex 4df4e7f..4df4e7f 100644 --- a/test/testfiles/plist_files/dapl_le +++ b/test/testfiles/plist_files/dapl_32be diff --git a/test/testfiles/plist_files/dapl_be b/test/testfiles/plist_files/dapl_32le Binary files differindex 4df4e7f..4df4e7f 100644 --- a/test/testfiles/plist_files/dapl_be +++ b/test/testfiles/plist_files/dapl_32le diff --git a/test/testfiles/plist_files/dapl_64be b/test/testfiles/plist_files/dapl_64be Binary files differnew file mode 100644 index 0000000..4df4e7f --- /dev/null +++ b/test/testfiles/plist_files/dapl_64be diff --git a/test/testfiles/plist_files/dapl_64le b/test/testfiles/plist_files/dapl_64le Binary files differnew file mode 100644 index 0000000..4df4e7f --- /dev/null +++ b/test/testfiles/plist_files/dapl_64le diff --git a/test/testfiles/plist_files/dcpl_le b/test/testfiles/plist_files/dcpl_32be Binary files differindex 667c67f..667c67f 100644 --- a/test/testfiles/plist_files/dcpl_le +++ b/test/testfiles/plist_files/dcpl_32be diff --git a/test/testfiles/plist_files/dcpl_be b/test/testfiles/plist_files/dcpl_32le Binary files differindex 667c67f..667c67f 100644 --- a/test/testfiles/plist_files/dcpl_be +++ b/test/testfiles/plist_files/dcpl_32le diff --git a/test/testfiles/plist_files/dcpl_64be b/test/testfiles/plist_files/dcpl_64be Binary files differnew file mode 100644 index 0000000..667c67f --- /dev/null +++ b/test/testfiles/plist_files/dcpl_64be diff --git a/test/testfiles/plist_files/dcpl_64le b/test/testfiles/plist_files/dcpl_64le Binary files differnew file mode 100644 index 0000000..667c67f --- /dev/null +++ b/test/testfiles/plist_files/dcpl_64le diff --git a/test/testfiles/plist_files/def_acpl_32be b/test/testfiles/plist_files/def_acpl_32be Binary files differnew file mode 100644 index 0000000..efd8168 --- /dev/null +++ b/test/testfiles/plist_files/def_acpl_32be diff --git a/test/testfiles/plist_files/def_acpl_32le b/test/testfiles/plist_files/def_acpl_32le Binary files differnew file mode 100644 index 0000000..efd8168 --- /dev/null +++ b/test/testfiles/plist_files/def_acpl_32le diff --git a/test/testfiles/plist_files/def_acpl_64be b/test/testfiles/plist_files/def_acpl_64be Binary files differnew file mode 100644 index 0000000..efd8168 --- /dev/null +++ b/test/testfiles/plist_files/def_acpl_64be diff --git a/test/testfiles/plist_files/def_acpl_64le b/test/testfiles/plist_files/def_acpl_64le Binary files differnew file mode 100644 index 0000000..efd8168 --- /dev/null +++ b/test/testfiles/plist_files/def_acpl_64le diff --git a/test/testfiles/plist_files/def_dapl_32be b/test/testfiles/plist_files/def_dapl_32be Binary files differnew file mode 100644 index 0000000..c9b7ea9 --- /dev/null +++ b/test/testfiles/plist_files/def_dapl_32be diff --git a/test/testfiles/plist_files/def_dapl_32le b/test/testfiles/plist_files/def_dapl_32le Binary files differnew file mode 100644 index 0000000..c9b7ea9 --- /dev/null +++ b/test/testfiles/plist_files/def_dapl_32le diff --git a/test/testfiles/plist_files/def_dapl_64be b/test/testfiles/plist_files/def_dapl_64be Binary files differnew file mode 100644 index 0000000..c9b7ea9 --- /dev/null +++ b/test/testfiles/plist_files/def_dapl_64be diff --git a/test/testfiles/plist_files/def_dapl_64le b/test/testfiles/plist_files/def_dapl_64le Binary files differnew file mode 100644 index 0000000..c9b7ea9 --- /dev/null +++ b/test/testfiles/plist_files/def_dapl_64le diff --git a/test/testfiles/plist_files/def_dcpl_32be b/test/testfiles/plist_files/def_dcpl_32be Binary files differnew file mode 100644 index 0000000..01b233c --- /dev/null +++ b/test/testfiles/plist_files/def_dcpl_32be diff --git a/test/testfiles/plist_files/def_dcpl_32le b/test/testfiles/plist_files/def_dcpl_32le Binary files differnew file mode 100644 index 0000000..01b233c --- /dev/null +++ b/test/testfiles/plist_files/def_dcpl_32le diff --git a/test/testfiles/plist_files/def_dcpl_64be b/test/testfiles/plist_files/def_dcpl_64be Binary files differnew file mode 100644 index 0000000..01b233c --- /dev/null +++ b/test/testfiles/plist_files/def_dcpl_64be diff --git a/test/testfiles/plist_files/def_dcpl_64le b/test/testfiles/plist_files/def_dcpl_64le Binary files differnew file mode 100644 index 0000000..01b233c --- /dev/null +++ b/test/testfiles/plist_files/def_dcpl_64le diff --git a/test/testfiles/plist_files/def_dxpl_32be b/test/testfiles/plist_files/def_dxpl_32be Binary files differnew file mode 100644 index 0000000..b13f456 --- /dev/null +++ b/test/testfiles/plist_files/def_dxpl_32be diff --git a/test/testfiles/plist_files/def_dxpl_32le b/test/testfiles/plist_files/def_dxpl_32le Binary files differnew file mode 100644 index 0000000..b13f456 --- /dev/null +++ b/test/testfiles/plist_files/def_dxpl_32le diff --git a/test/testfiles/plist_files/def_dxpl_64be b/test/testfiles/plist_files/def_dxpl_64be Binary files differnew file mode 100644 index 0000000..b13f456 --- /dev/null +++ b/test/testfiles/plist_files/def_dxpl_64be diff --git a/test/testfiles/plist_files/def_dxpl_64le b/test/testfiles/plist_files/def_dxpl_64le Binary files differnew file mode 100644 index 0000000..b13f456 --- /dev/null +++ b/test/testfiles/plist_files/def_dxpl_64le diff --git a/test/testfiles/plist_files/def_fapl_32be b/test/testfiles/plist_files/def_fapl_32be Binary files differnew file mode 100644 index 0000000..6b6baee --- /dev/null +++ b/test/testfiles/plist_files/def_fapl_32be diff --git a/test/testfiles/plist_files/def_fapl_32le b/test/testfiles/plist_files/def_fapl_32le Binary files differnew file mode 100644 index 0000000..6b6baee --- /dev/null +++ b/test/testfiles/plist_files/def_fapl_32le diff --git a/test/testfiles/plist_files/def_fapl_64be b/test/testfiles/plist_files/def_fapl_64be Binary files differnew file mode 100644 index 0000000..6b6baee --- /dev/null +++ b/test/testfiles/plist_files/def_fapl_64be diff --git a/test/testfiles/plist_files/def_fapl_64le b/test/testfiles/plist_files/def_fapl_64le Binary files differnew file mode 100644 index 0000000..6b6baee --- /dev/null +++ b/test/testfiles/plist_files/def_fapl_64le diff --git a/test/testfiles/plist_files/def_fcpl_32be b/test/testfiles/plist_files/def_fcpl_32be Binary files differnew file mode 100644 index 0000000..38dec23 --- /dev/null +++ b/test/testfiles/plist_files/def_fcpl_32be diff --git a/test/testfiles/plist_files/def_fcpl_32le b/test/testfiles/plist_files/def_fcpl_32le Binary files differnew file mode 100644 index 0000000..38dec23 --- /dev/null +++ b/test/testfiles/plist_files/def_fcpl_32le diff --git a/test/testfiles/plist_files/def_fcpl_64be b/test/testfiles/plist_files/def_fcpl_64be Binary files differnew file mode 100644 index 0000000..38dec23 --- /dev/null +++ b/test/testfiles/plist_files/def_fcpl_64be diff --git a/test/testfiles/plist_files/def_fcpl_64le b/test/testfiles/plist_files/def_fcpl_64le Binary files differnew file mode 100644 index 0000000..38dec23 --- /dev/null +++ b/test/testfiles/plist_files/def_fcpl_64le diff --git a/test/testfiles/plist_files/def_gcpl_32be b/test/testfiles/plist_files/def_gcpl_32be Binary files differnew file mode 100644 index 0000000..2b5a0cc --- /dev/null +++ b/test/testfiles/plist_files/def_gcpl_32be diff --git a/test/testfiles/plist_files/def_gcpl_32le b/test/testfiles/plist_files/def_gcpl_32le Binary files differnew file mode 100644 index 0000000..2b5a0cc --- /dev/null +++ b/test/testfiles/plist_files/def_gcpl_32le diff --git a/test/testfiles/plist_files/def_gcpl_64be b/test/testfiles/plist_files/def_gcpl_64be Binary files differnew file mode 100644 index 0000000..2b5a0cc --- /dev/null +++ b/test/testfiles/plist_files/def_gcpl_64be diff --git a/test/testfiles/plist_files/def_gcpl_64le b/test/testfiles/plist_files/def_gcpl_64le Binary files differnew file mode 100644 index 0000000..2b5a0cc --- /dev/null +++ b/test/testfiles/plist_files/def_gcpl_64le diff --git a/test/testfiles/plist_files/def_lapl_32be b/test/testfiles/plist_files/def_lapl_32be Binary files differnew file mode 100644 index 0000000..9cc0e96 --- /dev/null +++ b/test/testfiles/plist_files/def_lapl_32be diff --git a/test/testfiles/plist_files/def_lapl_32le b/test/testfiles/plist_files/def_lapl_32le Binary files differnew file mode 100644 index 0000000..9cc0e96 --- /dev/null +++ b/test/testfiles/plist_files/def_lapl_32le diff --git a/test/testfiles/plist_files/def_lapl_64be b/test/testfiles/plist_files/def_lapl_64be Binary files differnew file mode 100644 index 0000000..9cc0e96 --- /dev/null +++ b/test/testfiles/plist_files/def_lapl_64be diff --git a/test/testfiles/plist_files/def_lapl_64le b/test/testfiles/plist_files/def_lapl_64le Binary files differnew file mode 100644 index 0000000..9cc0e96 --- /dev/null +++ b/test/testfiles/plist_files/def_lapl_64le diff --git a/test/testfiles/plist_files/def_lcpl_32be b/test/testfiles/plist_files/def_lcpl_32be Binary files differnew file mode 100644 index 0000000..a02d26b --- /dev/null +++ b/test/testfiles/plist_files/def_lcpl_32be diff --git a/test/testfiles/plist_files/def_lcpl_32le b/test/testfiles/plist_files/def_lcpl_32le Binary files differnew file mode 100644 index 0000000..a02d26b --- /dev/null +++ b/test/testfiles/plist_files/def_lcpl_32le diff --git a/test/testfiles/plist_files/def_lcpl_64be b/test/testfiles/plist_files/def_lcpl_64be Binary files differnew file mode 100644 index 0000000..a02d26b --- /dev/null +++ b/test/testfiles/plist_files/def_lcpl_64be diff --git a/test/testfiles/plist_files/def_lcpl_64le b/test/testfiles/plist_files/def_lcpl_64le Binary files differnew file mode 100644 index 0000000..a02d26b --- /dev/null +++ b/test/testfiles/plist_files/def_lcpl_64le diff --git a/test/testfiles/plist_files/def_ocpl_32be b/test/testfiles/plist_files/def_ocpl_32be Binary files differnew file mode 100644 index 0000000..73b5ae0 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpl_32be diff --git a/test/testfiles/plist_files/def_ocpl_32le b/test/testfiles/plist_files/def_ocpl_32le Binary files differnew file mode 100644 index 0000000..73b5ae0 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpl_32le diff --git a/test/testfiles/plist_files/def_ocpl_64be b/test/testfiles/plist_files/def_ocpl_64be Binary files differnew file mode 100644 index 0000000..73b5ae0 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpl_64be diff --git a/test/testfiles/plist_files/def_ocpl_64le b/test/testfiles/plist_files/def_ocpl_64le Binary files differnew file mode 100644 index 0000000..73b5ae0 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpl_64le diff --git a/test/testfiles/plist_files/def_ocpypl_32be b/test/testfiles/plist_files/def_ocpypl_32be Binary files differnew file mode 100644 index 0000000..1ce6360 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpypl_32be diff --git a/test/testfiles/plist_files/def_ocpypl_32le b/test/testfiles/plist_files/def_ocpypl_32le Binary files differnew file mode 100644 index 0000000..1ce6360 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpypl_32le diff --git a/test/testfiles/plist_files/def_ocpypl_64be b/test/testfiles/plist_files/def_ocpypl_64be Binary files differnew file mode 100644 index 0000000..1ce6360 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpypl_64be diff --git a/test/testfiles/plist_files/def_ocpypl_64le b/test/testfiles/plist_files/def_ocpypl_64le Binary files differnew file mode 100644 index 0000000..1ce6360 --- /dev/null +++ b/test/testfiles/plist_files/def_ocpypl_64le diff --git a/test/testfiles/plist_files/def_strcpl_32be b/test/testfiles/plist_files/def_strcpl_32be Binary files differnew file mode 100644 index 0000000..986c591 --- /dev/null +++ b/test/testfiles/plist_files/def_strcpl_32be diff --git a/test/testfiles/plist_files/def_strcpl_32le b/test/testfiles/plist_files/def_strcpl_32le Binary files differnew file mode 100644 index 0000000..986c591 --- /dev/null +++ b/test/testfiles/plist_files/def_strcpl_32le diff --git a/test/testfiles/plist_files/def_strcpl_64be b/test/testfiles/plist_files/def_strcpl_64be Binary files differnew file mode 100644 index 0000000..986c591 --- /dev/null +++ b/test/testfiles/plist_files/def_strcpl_64be diff --git a/test/testfiles/plist_files/def_strcpl_64le b/test/testfiles/plist_files/def_strcpl_64le Binary files differnew file mode 100644 index 0000000..986c591 --- /dev/null +++ b/test/testfiles/plist_files/def_strcpl_64le diff --git a/test/testfiles/plist_files/dxpl_32be b/test/testfiles/plist_files/dxpl_32be Binary files differnew file mode 100644 index 0000000..5ff2ea0 --- /dev/null +++ b/test/testfiles/plist_files/dxpl_32be diff --git a/test/testfiles/plist_files/dxpl_32le b/test/testfiles/plist_files/dxpl_32le Binary files differnew file mode 100644 index 0000000..5ff2ea0 --- /dev/null +++ b/test/testfiles/plist_files/dxpl_32le diff --git a/test/testfiles/plist_files/dxpl_64be b/test/testfiles/plist_files/dxpl_64be Binary files differnew file mode 100644 index 0000000..5ff2ea0 --- /dev/null +++ b/test/testfiles/plist_files/dxpl_64be diff --git a/test/testfiles/plist_files/dxpl_64le b/test/testfiles/plist_files/dxpl_64le Binary files differnew file mode 100644 index 0000000..5ff2ea0 --- /dev/null +++ b/test/testfiles/plist_files/dxpl_64le diff --git a/test/testfiles/plist_files/dxpl_be b/test/testfiles/plist_files/dxpl_be Binary files differdeleted file mode 100644 index b5194c8..0000000 --- a/test/testfiles/plist_files/dxpl_be +++ /dev/null diff --git a/test/testfiles/plist_files/dxpl_le b/test/testfiles/plist_files/dxpl_le Binary files differdeleted file mode 100644 index b5194c8..0000000 --- a/test/testfiles/plist_files/dxpl_le +++ /dev/null diff --git a/test/testfiles/plist_files/fapl_le b/test/testfiles/plist_files/fapl_32be Binary files differindex 65e2070..65e2070 100644 --- a/test/testfiles/plist_files/fapl_le +++ b/test/testfiles/plist_files/fapl_32be diff --git a/test/testfiles/plist_files/fapl_be b/test/testfiles/plist_files/fapl_32le Binary files differindex 65e2070..65e2070 100644 --- a/test/testfiles/plist_files/fapl_be +++ b/test/testfiles/plist_files/fapl_32le diff --git a/test/testfiles/plist_files/fapl_64be b/test/testfiles/plist_files/fapl_64be Binary files differnew file mode 100644 index 0000000..65e2070 --- /dev/null +++ b/test/testfiles/plist_files/fapl_64be diff --git a/test/testfiles/plist_files/fapl_64le b/test/testfiles/plist_files/fapl_64le Binary files differnew file mode 100644 index 0000000..65e2070 --- /dev/null +++ b/test/testfiles/plist_files/fapl_64le diff --git a/test/testfiles/plist_files/fcpl_le b/test/testfiles/plist_files/fcpl_32be Binary files differindex ffa5242..ffa5242 100644 --- a/test/testfiles/plist_files/fcpl_le +++ b/test/testfiles/plist_files/fcpl_32be diff --git a/test/testfiles/plist_files/fcpl_be b/test/testfiles/plist_files/fcpl_32le Binary files differindex ffa5242..ffa5242 100644 --- a/test/testfiles/plist_files/fcpl_be +++ b/test/testfiles/plist_files/fcpl_32le diff --git a/test/testfiles/plist_files/fcpl_64be b/test/testfiles/plist_files/fcpl_64be Binary files differnew file mode 100644 index 0000000..ffa5242 --- /dev/null +++ b/test/testfiles/plist_files/fcpl_64be diff --git a/test/testfiles/plist_files/fcpl_64le b/test/testfiles/plist_files/fcpl_64le Binary files differnew file mode 100644 index 0000000..ffa5242 --- /dev/null +++ b/test/testfiles/plist_files/fcpl_64le diff --git a/test/testfiles/plist_files/gcpl_le b/test/testfiles/plist_files/gcpl_32be Binary files differindex 1eec32c..1eec32c 100644 --- a/test/testfiles/plist_files/gcpl_le +++ b/test/testfiles/plist_files/gcpl_32be diff --git a/test/testfiles/plist_files/gcpl_be b/test/testfiles/plist_files/gcpl_32le Binary files differindex 1eec32c..1eec32c 100644 --- a/test/testfiles/plist_files/gcpl_be +++ b/test/testfiles/plist_files/gcpl_32le diff --git a/test/testfiles/plist_files/gcpl_64be b/test/testfiles/plist_files/gcpl_64be Binary files differnew file mode 100644 index 0000000..1eec32c --- /dev/null +++ b/test/testfiles/plist_files/gcpl_64be diff --git a/test/testfiles/plist_files/gcpl_64le b/test/testfiles/plist_files/gcpl_64le Binary files differnew file mode 100644 index 0000000..1eec32c --- /dev/null +++ b/test/testfiles/plist_files/gcpl_64le diff --git a/test/testfiles/plist_files/lapl_be b/test/testfiles/plist_files/lapl_32be Binary files differindex 385cfc5..e9f43e2 100644 --- a/test/testfiles/plist_files/lapl_be +++ b/test/testfiles/plist_files/lapl_32be diff --git a/test/testfiles/plist_files/lapl_le b/test/testfiles/plist_files/lapl_32le Binary files differindex 385cfc5..e9f43e2 100644 --- a/test/testfiles/plist_files/lapl_le +++ b/test/testfiles/plist_files/lapl_32le diff --git a/test/testfiles/plist_files/lapl_64be b/test/testfiles/plist_files/lapl_64be Binary files differnew file mode 100644 index 0000000..e9f43e2 --- /dev/null +++ b/test/testfiles/plist_files/lapl_64be diff --git a/test/testfiles/plist_files/lapl_64le b/test/testfiles/plist_files/lapl_64le Binary files differnew file mode 100644 index 0000000..e9f43e2 --- /dev/null +++ b/test/testfiles/plist_files/lapl_64le diff --git a/test/testfiles/plist_files/lcpl_le b/test/testfiles/plist_files/lcpl_32be Binary files differindex 4584e5c..4584e5c 100644 --- a/test/testfiles/plist_files/lcpl_le +++ b/test/testfiles/plist_files/lcpl_32be diff --git a/test/testfiles/plist_files/lcpl_be b/test/testfiles/plist_files/lcpl_32le Binary files differindex 4584e5c..4584e5c 100644 --- a/test/testfiles/plist_files/lcpl_be +++ b/test/testfiles/plist_files/lcpl_32le diff --git a/test/testfiles/plist_files/lcpl_64be b/test/testfiles/plist_files/lcpl_64be Binary files differnew file mode 100644 index 0000000..4584e5c --- /dev/null +++ b/test/testfiles/plist_files/lcpl_64be diff --git a/test/testfiles/plist_files/lcpl_64le b/test/testfiles/plist_files/lcpl_64le Binary files differnew file mode 100644 index 0000000..4584e5c --- /dev/null +++ b/test/testfiles/plist_files/lcpl_64le diff --git a/test/testfiles/plist_files/ocpl_le b/test/testfiles/plist_files/ocpl_32be Binary files differindex bc46636..bc46636 100644 --- a/test/testfiles/plist_files/ocpl_le +++ b/test/testfiles/plist_files/ocpl_32be diff --git a/test/testfiles/plist_files/ocpl_be b/test/testfiles/plist_files/ocpl_32le Binary files differindex bc46636..bc46636 100644 --- a/test/testfiles/plist_files/ocpl_be +++ b/test/testfiles/plist_files/ocpl_32le diff --git a/test/testfiles/plist_files/ocpl_64be b/test/testfiles/plist_files/ocpl_64be Binary files differnew file mode 100644 index 0000000..bc46636 --- /dev/null +++ b/test/testfiles/plist_files/ocpl_64be diff --git a/test/testfiles/plist_files/ocpl_64le b/test/testfiles/plist_files/ocpl_64le Binary files differnew file mode 100644 index 0000000..bc46636 --- /dev/null +++ b/test/testfiles/plist_files/ocpl_64le diff --git a/test/testfiles/plist_files/ocpypl_le b/test/testfiles/plist_files/ocpypl_32be Binary files differindex a0d826d..a0d826d 100644 --- a/test/testfiles/plist_files/ocpypl_le +++ b/test/testfiles/plist_files/ocpypl_32be diff --git a/test/testfiles/plist_files/ocpypl_be b/test/testfiles/plist_files/ocpypl_32le Binary files differindex a0d826d..a0d826d 100644 --- a/test/testfiles/plist_files/ocpypl_be +++ b/test/testfiles/plist_files/ocpypl_32le diff --git a/test/testfiles/plist_files/ocpypl_64be b/test/testfiles/plist_files/ocpypl_64be Binary files differnew file mode 100644 index 0000000..a0d826d --- /dev/null +++ b/test/testfiles/plist_files/ocpypl_64be diff --git a/test/testfiles/plist_files/ocpypl_64le b/test/testfiles/plist_files/ocpypl_64le Binary files differnew file mode 100644 index 0000000..a0d826d --- /dev/null +++ b/test/testfiles/plist_files/ocpypl_64le diff --git a/test/testfiles/plist_files/strcpl_le b/test/testfiles/plist_files/strcpl_32be Binary files differindex 4190a63..4190a63 100644 --- a/test/testfiles/plist_files/strcpl_le +++ b/test/testfiles/plist_files/strcpl_32be diff --git a/test/testfiles/plist_files/strcpl_be b/test/testfiles/plist_files/strcpl_32le Binary files differindex 4190a63..4190a63 100644 --- a/test/testfiles/plist_files/strcpl_be +++ b/test/testfiles/plist_files/strcpl_32le diff --git a/test/testfiles/plist_files/strcpl_64be b/test/testfiles/plist_files/strcpl_64be Binary files differnew file mode 100644 index 0000000..4190a63 --- /dev/null +++ b/test/testfiles/plist_files/strcpl_64be diff --git a/test/testfiles/plist_files/strcpl_64le b/test/testfiles/plist_files/strcpl_64le Binary files differnew file mode 100644 index 0000000..4190a63 --- /dev/null +++ b/test/testfiles/plist_files/strcpl_64le diff --git a/test/testframe.c b/test/testframe.c index 2dd181b..daa27c5 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -213,6 +213,7 @@ void TestInfo(const char *ProgName) */ void TestParseCmdLine(int argc, char *argv[]) { + hbool_t skipped_all = FALSE; int ret_code; while (argv++, --argc > 0){ @@ -248,14 +249,20 @@ void TestParseCmdLine(int argc, char *argv[]) } else if (((HDstrcmp(*argv, "-only") == 0) || (HDstrcmp(*argv, "-o") == 0))) { - if (argc > 0){ + if(argc > 0) { int Loop; + --argc; ++argv; + /* Skip all tests, then activate only one. */ - for (Loop = 0; Loop < Index; Loop++) - Test[Loop].SkipFlag = 1; + if(!skipped_all) { + for(Loop = 0; Loop < Index; Loop++) + Test[Loop].SkipFlag = 1; + skipped_all = TRUE; + } /* end if */ SetTest(*argv, ONLYTEST); - }else{ + } /* end if */ + else { TestUsage(); exit(EXIT_FAILURE); } @@ -548,6 +555,7 @@ TestErrPrintf(const char *format, ...) void SetTest(const char *testname, int action) { int Loop; + switch (action){ case SKIPTEST: for (Loop = 0; Loop < Index; Loop++) @@ -569,17 +577,12 @@ void SetTest(const char *testname, int action) break; case ONLYTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else { + if (HDstrcmp(testname, Test[Loop].Name) == 0) { /* Found it. Set it to run. Break to skip the rest. */ Test[Loop].SkipFlag = 0; break; } } - /* skip the rest */ - while (++Loop < Index) - Test[Loop].SkipFlag = 1; break; default: /* error */ diff --git a/test/tfile.c b/test/tfile.c index 33c947f..5fc528e 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -32,7 +32,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -2796,6 +2796,10 @@ test_free_sections(hid_t fapl, char *fname) file = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); + /* Close the FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); + /* Create dataspace for datasets */ dspace = H5Screate(H5S_SCALAR); CHECK(dspace, FAIL, "H5Screate"); @@ -2920,9 +2924,6 @@ test_free_sections(hid_t fapl, char *fname) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - ret = H5Pclose(fcpl); - CHECK(fcpl, FAIL, "H5Pclose"); - HDfree(saved_sect_info); } /* end test_free_sections() */ @@ -2960,7 +2961,7 @@ test_filespace_sects(void) test_free_sections(fapl_sec2, filename); /* close fapl_sec2 and remove the file */ - h5_cleanup(FILENAME, fapl_sec2); + h5_clean_files(FILENAME, fapl_sec2); /* SPLIT */ @@ -2979,7 +2980,7 @@ test_filespace_sects(void) test_free_sections(fapl_split, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_split); + h5_clean_files(FILENAME, fapl_split); /* STDIO */ @@ -2998,7 +2999,8 @@ test_filespace_sects(void) test_free_sections(fapl_stdio, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_stdio); + h5_clean_files(FILENAME, fapl_stdio); + /* CORE */ MESSAGE(5, ("Testing File free space information for a core file\n")); @@ -3016,7 +3018,7 @@ test_filespace_sects(void) test_free_sections(fapl_core, filename); /* close fapl_ and remove the file */ - h5_cleanup(FILENAME, fapl_core); + h5_clean_files(FILENAME, fapl_core); /* FAMILY */ @@ -3035,7 +3037,7 @@ test_filespace_sects(void) test_free_sections(fapl_family, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_family); + h5_clean_files(FILENAME, fapl_family); } /* end test_filespace_sects() */ @@ -3155,7 +3157,7 @@ test_filespace_info(void) } /* end for file space strategy type */ } /* end for free space threshold */ - h5_cleanup(FILESPACE_NAME, my_fapl); + h5_clean_files(FILESPACE_NAME, my_fapl); } /* end for new/old format */ diff --git a/test/tgenprop.c b/test/tgenprop.c index fda4161..c4f3a3f 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -21,7 +21,7 @@ * *************************************************************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ +#define H5P_FRIEND /*suppress error about including H5Ppkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5P_TESTING @@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1203,9 +1203,9 @@ test_genprop_list_callback(void) lid1 = H5Pcreate(cid1); CHECK_I(lid1, "H5Pcreate"); - /* The compare callback should have been called once on property 1 (to check - * if the create callback modified the value) */ - VERIFY(prop1_cb_info.cmp_count, 1, "H5Pcreate"); + /* The compare callback should not have been called once on property 1, as + * the property is always copied */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pcreate"); /* The compare callback should not have been called on property 3, as there * is no create callback */ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pcreate"); @@ -1221,9 +1221,8 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP1_NAME,&prop1_value); CHECK_I(ret, "H5Pget"); VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); - /* The compare callback should have been called once (to check if the get - * callback modified the value) */ - VERIFY(prop1_cb_info.cmp_count, 2, "H5Pget"); + /* The compare callback should not have been called */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pget"); ret = H5Pget(lid1, PROP2_NAME,&prop2_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ @@ -1242,7 +1241,7 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1266,17 +1265,15 @@ test_genprop_list_callback(void) if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value, PROP1_SIZE)!=0) TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); - /* The compare callback should have been called once (to check if the new - * value needed to be copied onto the property list) */ - VERIFY(prop1_cb_info.cmp_count, 3, "H5Pset"); + /* The compare callback should not have been called */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pset"); /* Set value of property #3 to different value */ ret = H5Pset(lid1, PROP3_NAME,prop3_new_value); CHECK_I(ret, "H5Pset"); - /* The compare callback should have been called once (to check if the new - * value needed to be copied onto the property list) */ - VERIFY(prop3_cb_info.cmp_count, 1, "H5Pset"); + /* The compare callback should not have been called */ + VERIFY(prop3_cb_info.cmp_count, 0, "H5Pset"); /* Check new value of tracked properties */ ret = H5Pget(lid1, PROP1_NAME,&prop1_value); @@ -1323,8 +1320,8 @@ test_genprop_list_callback(void) VERIFY(ret, 1, "H5Pequal"); /* Verify compare callback information for properties tracked */ - VERIFY(prop1_cb_info.cmp_count, 4, "H5Pequal"); - VERIFY(prop3_cb_info.cmp_count, 2, "H5Pequal"); + VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal"); + VERIFY(prop3_cb_info.cmp_count, 1, "H5Pequal"); /* Close first list */ ret = H5Pclose(lid1); diff --git a/test/th5o.c b/test/th5o.c index 40844fa..90f3c9b 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -164,7 +164,7 @@ test_h5o_close(void) /* Create the group and close it with H5Oclose */ grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(grp, FAIL, "H5Gcreate2"); - VERIFY(H5Iget_type(grp), H5I_GROUP, "H5Iget_type"); + VERIFY_TYPE(H5Iget_type(grp), H5I_GROUP, H5I_type_t, "%d", "H5Iget_type"); ret = H5Oclose(grp); CHECK(ret, FAIL, "H5Oclose"); @@ -19,7 +19,7 @@ #include "hdf5.h" /* Include H5Ipkg.h to calculate max number of groups */ -#define H5I_PACKAGE +#define H5I_FRIEND /*suppress error about including H5Ipkg */ #include "H5Ipkg.h" /* Test basic functionality of registering and deleting types and IDs */ diff --git a/test/titerate.c b/test/titerate.c index fff13f1..98428ea 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -704,7 +704,7 @@ static void test_grp_memb_funcs(hid_t fapl) char dataset_name[NAMELEN]; /* dataset name */ ssize_t name_len; /* Length of object's name */ H5G_info_t ginfo; /* Buffer for querying object's info */ - herr_t ret; /* Generic return value */ + herr_t ret = SUCCEED; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Group Member Information Functionality\n")); diff --git a/test/tmisc.c b/test/tmisc.c index 6a68857..fa0f150 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -23,7 +23,7 @@ * *************************************************************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5D_TESTING @@ -1254,7 +1254,7 @@ test_misc8(void) tdata=wdata; for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++) - *tdata++=((u*MISC8_DIM1)+v)%13; + *tdata++ = (int)(((u * MISC8_DIM1) + v) % 13); /* Create a file acccess property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -1310,7 +1310,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1336,7 +1336,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1361,7 +1361,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1405,7 +1405,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1432,7 +1432,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1462,7 +1462,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1486,7 +1486,7 @@ test_misc8(void) /* Check the storage size after only four chunks are written */ storage_size = H5Dget_storage_size(did); - VERIFY(storage_size, 4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Write entire dataset */ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); @@ -1509,7 +1509,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -2701,8 +2701,7 @@ test_misc16(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */ hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ @@ -2710,6 +2709,13 @@ test_misc16(void) hsize_t dims[] = {MISC16_SPACE_DIM}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC16_STR_SIZE); + HDmemcpy(wdata[1], "1234567\0", MISC16_STR_SIZE); + HDmemcpy(wdata[2], "12345678", MISC16_STR_SIZE); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC16_STR_SIZE); + /* Create the file */ file = H5Fcreate(MISC16_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2743,11 +2749,11 @@ test_misc16(void) /* Compare data read in */ for(i = 0; i < MISC16_SPACE_DIM; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -2780,8 +2786,7 @@ test_misc17(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */ hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ @@ -2789,6 +2794,13 @@ test_misc17(void) hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC17_SPACE_DIM2); + HDmemcpy(wdata[1], "1234567\0", MISC17_SPACE_DIM2); + HDmemcpy(wdata[2], "12345678", MISC17_SPACE_DIM2); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC17_SPACE_DIM2); + /* Create the file */ file = H5Fcreate(MISC17_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2819,11 +2831,11 @@ test_misc17(void) /* Compare data in the way of strings. */ for(i = 0; i < MISC17_SPACE_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -3782,6 +3794,7 @@ test_misc23(void) char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ H5O_info_t oinfo; htri_t tri_status; + ssize_t namelen; herr_t status; /* Output message about test being performed */ @@ -3851,8 +3864,8 @@ test_misc23(void) CHECK(tmp_id, FAIL, "H5Gcreate2"); /* Query that the name of the new group is correct */ - status = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); - CHECK(status, FAIL, "H5Iget_name"); + namelen = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); + CHECK(namelen, FAIL, "H5Iget_name"); VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); status = H5Gclose(tmp_id); @@ -4991,7 +5004,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = i; + buf[i] = (char)i; /* Create memory dataspace and selection in file dataspace */ sidm = H5Screate_simple(1, mdims, NULL); @@ -5012,7 +5025,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = MISC28_SIZE - 1 - i; + buf[i] = (char)(MISC28_SIZE - 1 - i); /* Select new hyperslab */ start[1] = 1; diff --git a/test/tselect.c b/test/tselect.c index 2062e73..670406d 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -21,7 +21,7 @@ * *************************************************************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5S_FRIEND /*suppress error about including H5Spkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5S_TESTING diff --git a/test/tsohm.c b/test/tsohm.c index e22940f..b3ffac7 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -27,7 +27,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -1279,7 +1279,7 @@ static void size2_verify_plist1(hid_t plist) CHECK_I(ret, "H5Pget_fill_value"); ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); - VERIFY(ret, 0, memcmp); + VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype1_id); CHECK_I(ret, "H5Tclose"); @@ -1350,7 +1350,7 @@ static void size2_verify_plist2(hid_t plist) CHECK_I(ret, "H5Pget_fill_value"); ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE); - VERIFY(ret, 0, memcmp); + VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype2_id); CHECK_I(ret, "H5Tclose"); diff --git a/test/unlink.c b/test/unlink.c index 993a7ec..c091281 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -20,7 +20,7 @@ * Purpose: Test unlinking operations. */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING @@ -309,7 +309,7 @@ error: /*------------------------------------------------------------------------- - * Function: test_api + * Function: test_api_get_ex_dcpl * * Purpose: Tests API functions related to virtual datasets. * @@ -7536,7 +7536,8 @@ test_printf(unsigned config, hid_t fapl) * Test 3: 1 Source dataset mapping, 10x5 blocks, printf source file */ /* Clean up files so the source files do not exist yet */ - h5_cleanup_files(FILENAME, fapl); + H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ + h5_clean_files(FILENAME, fapl); /* Clear virtual layout in DCPL */ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) @@ -7846,7 +7847,8 @@ test_printf(unsigned config, hid_t fapl) * source dset, extra %%s in source dataset name */ /* Clean up files so the source files do not exist yet */ - h5_cleanup_files(FILENAME, fapl); + H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ + h5_clean_files(FILENAME, fapl); /* Clear virtual layout in DCPL */ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) @@ -11087,7 +11089,7 @@ error: } H5E_END_TRY; return 1; -} /* end test_printf() */ +} /* end test_all() */ /*------------------------------------------------------------------------- @@ -11135,7 +11137,7 @@ main(void) if(nerrors) goto error; printf("All virtual dataset tests passed.\n"); -// h5_cleanup(FILENAME, fapl); + h5_cleanup(FILENAME, fapl); return 0; @@ -80,15 +80,17 @@ const char *FILENAME[] = { static herr_t test_sec2(void) { - hid_t file = -1; - hid_t fapl = -1; - hid_t access_fapl = -1; + 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"); + h5_reset(); + /* Set property list and file name for SEC2 driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_sec2(fapl) < 0) @@ -141,107 +143,103 @@ error: return -1; } - /*------------------------------------------------------------------------- - * Function: test_direct + * Function: test_core * - * Purpose: Tests the file handle interface for DIRECT I/O driver + * Purpose: Tests the file handle interface for CORE driver * * Return: Success: 0 * Failure: -1 * * Programmer: Raymond Lu - * Wednesday, 20 September 2006 + * Tuesday, Sept 24, 2002 * *------------------------------------------------------------------------- */ static herr_t -test_direct(void) +test_core(void) { -#ifdef H5_HAVE_DIRECT hid_t file=(-1), fapl, access_fapl = -1; - hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; char filename[1024]; - int *fhandle=NULL; + void *fhandle=NULL; hsize_t file_size; - hsize_t dims1[2], dims2[1]; - size_t mbound; - size_t fbsize; - size_t cbsize; + hbool_t use_write_tracking; + size_t write_tracking_page_size; int *points = NULL, *check = NULL, *p1, *p2; - int wdata2[DSET2_DIM] = {11,12,13,14}; - int rdata2[DSET2_DIM]; + hid_t dset1=-1, space1=-1; + hsize_t dims1[2]; int i, j, n; -#endif /*H5_HAVE_DIRECT*/ - TESTING("DIRECT I/O file driver"); + TESTING("CORE file driver"); -#ifndef H5_HAVE_DIRECT - SKIPPED(); - return 0; -#else /*H5_HAVE_DIRECT*/ + h5_reset(); - /* Set property list and file name for Direct driver. Set memory alignment boundary - * and file block size to 512 which is the minimum for Linux 2.6. */ + /* Set property list and file name for CORE driver */ fapl = h5_fileaccess(); - if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0) - TEST_ERROR; - h5_fixname(FILENAME[5], fapl, filename, sizeof filename); - - /* Verify the file access properties */ - if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; - if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) + if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) TEST_ERROR; + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; - H5E_BEGIN_TRY { - file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file<0) { - H5Pclose (fapl); - SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); - return 0; - } - /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; /* Check that the driver is correct */ - if(H5FD_DIRECT != H5Pget_driver(access_fapl)) + if(H5FD_CORE != H5Pget_driver(access_fapl)) + TEST_ERROR; + + /* Check that the backing store write tracking info was saved */ + if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0) + TEST_ERROR; + if(TRUE != use_write_tracking) + TEST_ERROR; + if(CORE_PAGE_SIZE != write_tracking_page_size) 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) + if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0) TEST_ERROR; + if(fhandle==NULL) + { + printf("fhandle==NULL\n"); + TEST_ERROR; + } /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - /* There is no guarantee of the number of metadata allocations, but it's - * 4 currently and the size of the file should be between 3 & 4 file buffer - * sizes.. + /* There is no garantee the size of metadata in file is constant. + * Just try to check if it's reasonable. Why is this 4KB? */ - if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4)) + if(file_size<2*KB || file_size>6*KB) TEST_ERROR; - /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including - * memory address, size of data, and file address. */ - if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if(H5Fclose(file) < 0) TEST_ERROR; - if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + + + /* Open the file with backing store off for read and write. + * Changes won't be saved in file. */ + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0) + TEST_ERROR; + + if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* Allocate memory for data set. */ + if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + TEST_ERROR; + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Initialize the dset1 */ @@ -284,47 +282,70 @@ test_direct(void) printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } /* end if */ + } /* end if */ - /* Create the data space2. For data set 2, memory address and data size are not aligned. */ - dims2[0] = DSET2_DIM; - if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; - /* Create the dset2 */ - if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if(H5Fclose(file) < 0) + TEST_ERROR; + + /* Open the file with backing store on for read and write. + * Changes will be saved in file. */ + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) + TEST_ERROR; + + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* Create the dset1 */ + if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; - if(H5Dclose(dset2) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Reallocate memory for reading buffer. */ + HDassert(check); + HDfree(check); + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Read the data back from dset1 */ - if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for(i = 0; i < DSET2_DIM; i++) - if(wdata2[i] != rdata2[i]) { - H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); - TEST_ERROR; - } /* end if */ + p1 = points; + p2 = check; + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ - if(H5Sclose(space1) < 0) + /* Check file size API */ + if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - if(H5Dclose(dset1) < 0) + + /* There is no garantee the size of metadata in file is constant. + * Just try to check if it's reasonable. */ + if(file_size<64*KB || file_size>256*KB) TEST_ERROR; - if(H5Sclose(space2) < 0) + + if(H5Sclose(space1) < 0) TEST_ERROR; - if(H5Dclose(dset2) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; @@ -334,16 +355,13 @@ test_direct(void) HDfree(check); h5_cleanup(FILENAME, fapl); + PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(fapl); - H5Sclose(space1); - H5Dclose(dset1); - H5Sclose(space2); - H5Dclose(dset2); H5Fclose(file); } H5E_END_TRY; @@ -353,104 +371,110 @@ error: HDfree(check); return -1; -#endif /*H5_HAVE_DIRECT*/ } /*------------------------------------------------------------------------- - * Function: test_core + * Function: test_direct * - * Purpose: Tests the file handle interface for CORE driver + * Purpose: Tests the file handle interface for DIRECT I/O driver * * Return: Success: 0 * Failure: -1 * * Programmer: Raymond Lu - * Tuesday, Sept 24, 2002 + * Wednesday, 20 September 2006 * *------------------------------------------------------------------------- */ static herr_t -test_core(void) +test_direct(void) { +#ifdef H5_HAVE_DIRECT hid_t file=(-1), fapl, access_fapl = -1; + hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; char filename[1024]; - void *fhandle=NULL; + int *fhandle=NULL; hsize_t file_size; - hbool_t use_write_tracking; - size_t write_tracking_page_size; + hsize_t dims1[2], dims2[1]; + size_t mbound; + size_t fbsize; + size_t cbsize; int *points = NULL, *check = NULL, *p1, *p2; - hid_t dset1=-1, space1=-1; - hsize_t dims1[2]; + int wdata2[DSET2_DIM] = {11,12,13,14}; + int rdata2[DSET2_DIM]; int i, j, n; +#endif /*H5_HAVE_DIRECT*/ - TESTING("CORE file driver"); + TESTING("DIRECT I/O file driver"); - /* Set property list and file name for CORE driver */ +#ifndef H5_HAVE_DIRECT + SKIPPED(); + return 0; +#else /*H5_HAVE_DIRECT*/ + + h5_reset(); + + /* Set property list and file name for Direct driver. Set memory alignment boundary + * and file block size to 512 which is the minimum for Linux 2.6. */ fapl = h5_fileaccess(); - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) + if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0) TEST_ERROR; - if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) + h5_fixname(FILENAME[5], fapl, filename, sizeof filename); + + /* Verify the file access properties */ + if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) + TEST_ERROR; + if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) TEST_ERROR; - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) TEST_ERROR; + H5E_BEGIN_TRY { + file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file<0) { + H5Pclose (fapl); + SKIPPED(); + printf(" Probably the file system doesn't support Direct I/O\n"); + return 0; + } + /* Retrieve the access property list... */ 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; - - /* Check that the backing store write tracking info was saved */ - if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0) - TEST_ERROR; - if(TRUE != use_write_tracking) - TEST_ERROR; - if(CORE_PAGE_SIZE != write_tracking_page_size) + if(H5FD_DIRECT != H5Pget_driver(access_fapl)) TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; - if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0) + /* Check file handle API */ + if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + TEST_ERROR; + if(*fhandle<0) TEST_ERROR; - if(fhandle==NULL) - { - printf("fhandle==NULL\n"); - 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. - * Just try to check if it's reasonable. Why is this 4KB? + /* There is no guarantee of the number of metadata allocations, but it's + * 4 currently and the size of the file should be between 3 & 4 file buffer + * sizes.. */ - if(file_size<2*KB || file_size>6*KB) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - - /* Open the file with backing store off for read and write. - * Changes won't be saved in file. */ - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR; - - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4)) TEST_ERROR; - /* Allocate memory for data set. */ - if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including + * memory address, size of data, and file address. */ + if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; - if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Initialize the dset1 */ @@ -493,71 +517,48 @@ test_core(void) printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } /* end if */ - - if(H5Dclose(dset1) < 0) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - /* Open the file with backing store on for read and write. - * Changes will be saved in file. */ - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR; + } /* end if */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + /* Create the data space2. For data set 2, memory address and data size are not aligned. */ + dims2[0] = DSET2_DIM; + if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) TEST_ERROR; - /* Create the dset1 */ - if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Create the dset2 */ + if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - TEST_ERROR; - - if(H5Dclose(dset1) < 0) + if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; - if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) + if(H5Dclose(dset2) < 0) TEST_ERROR; - /* Reallocate memory for reading buffer. */ - HDassert(check); - HDfree(check); - if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - p1 = points; - p2 = check; - for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ - - /* 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. - * Just try to check if it's reasonable. */ - if(file_size<64*KB || file_size>256*KB) - TEST_ERROR; + for(i = 0; i < DSET2_DIM; i++) + if(wdata2[i] != rdata2[i]) { + H5_FAILED(); + printf(" Read different values than written in data set 2.\n"); + printf(" At index %d\n", i); + TEST_ERROR; + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; + if(H5Sclose(space2) < 0) + TEST_ERROR; + if(H5Dclose(dset2) < 0) + TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; HDassert(points); @@ -566,13 +567,16 @@ test_core(void) HDfree(check); h5_cleanup(FILENAME, fapl); - PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(fapl); + H5Sclose(space1); + H5Dclose(dset1); + H5Sclose(space2); + H5Dclose(dset2); H5Fclose(file); } H5E_END_TRY; @@ -582,6 +586,7 @@ error: HDfree(check); return -1; +#endif /*H5_HAVE_DIRECT*/ } @@ -685,6 +690,8 @@ test_family(void) TESTING("FAMILY file driver"); + h5_reset(); + /* Set property list and file name for FAMILY driver */ fapl = h5_fileaccess(); @@ -846,6 +853,8 @@ test_family_compat(void) TESTING("FAMILY file driver backward compatibility"); + h5_reset(); + /* Set property list and file name for FAMILY driver */ fapl = h5_fileaccess(); @@ -982,6 +991,9 @@ test_multi(void) int buf[MULTI_SIZE][MULTI_SIZE]; TESTING("MULTI file driver"); + + h5_reset(); + /* Set file access property list for MULTI driver */ fapl = h5_fileaccess(); @@ -1194,6 +1206,8 @@ test_multi_compat(void) TESTING("MULTI file driver backward compatibility"); + h5_reset(); + /* Set file access property list for MULTI driver */ fapl = h5_fileaccess(); @@ -1349,6 +1363,8 @@ test_log(void) TESTING("LOG file driver"); + h5_reset(); + /* Set property list and file name for log driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0) @@ -1428,6 +1444,8 @@ test_stdio(void) TESTING("STDIO file driver"); + h5_reset(); + /* Set property list and file name for STDIO driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_stdio(fapl) < 0) @@ -1518,6 +1536,8 @@ test_windows(void) #else /* H5_HAVE_WINDOWS */ + h5_reset(); + /* Set property list and file name for WINDOWS driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_windows(fapl) < 0) @@ -1592,25 +1612,23 @@ main(void) { int nerrors = 0; - h5_reset(); - printf("Testing basic Virtual File Driver functionality.\n"); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; + nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 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", - nerrors, nerrors > 1 ? "S" : ""); - return 1; + printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return 1; } printf("All Virtual File Driver tests passed.\n"); |