From 9dfe3e854f023fb2351cdd014c1954297e9fd921 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 19 Nov 2013 18:00:19 -0500 Subject: [svn-r24457] Bring revisions #24333 - #24432 from trunk to revise_chunks. h5committested. --- CMakeInstallation.cmake | 13 +- MANIFEST | 6 +- README.txt | 2 +- c++/src/Makefile.in | 2 +- c++/test/CMakeTests.cmake | 25 + c++/test/Makefile.am | 3 + c++/test/Makefile.in | 5 +- c++/test/tcompound.cpp | 56 +- config/cmake/H5pubconf.h.in | 6 +- config/cmake/HDF518_Examples.cmake.in | 15 +- config/lt_vers.am | 2 +- configure | 26 +- configure.ac | 6 +- examples/CMakeTests.cmake | 3 + fortran/examples/CMakeTests.cmake | 24 + fortran/src/H5Df.c | 40 +- fortran/src/H5Sf.c | 4 +- fortran/src/Makefile.in | 2 +- hl/c++/examples/CMakeTests.cmake | 8 + hl/c++/src/Makefile.in | 2 +- hl/examples/CMakeLists.txt | 2 +- hl/examples/CMakeTests.cmake | 36 +- hl/fortran/src/H5IMcc.c | 4 +- hl/fortran/src/H5IMfc.c | 32 +- hl/fortran/src/H5LTfc.c | 66 +- hl/fortran/src/Makefile.in | 2 +- hl/fortran/test/CMakeTests.cmake | 3 +- hl/fortran/test/Makefile.am | 2 +- hl/fortran/test/Makefile.in | 2 +- hl/src/H5DS.c | 94 +-- hl/src/H5HLprivate2.h | 94 +-- hl/src/H5IM.c | 12 +- hl/src/H5LT.c | 5 +- hl/src/H5PT.c | 34 +- hl/src/H5TB.c | 118 +-- hl/src/Makefile.in | 2 +- hl/src/hdf5_hl.h | 2 +- hl/test/CMakeTests.cmake | 3 + hl/test/gen_test_ds.c | 4 +- hl/test/test_dset_opt.c | 10 +- hl/test/test_file_image.c | 10 +- release_docs/RELEASE.txt | 2 +- release_docs/USING_CMake_Examples.txt | 93 ++- src/H5F.c | 132 +-- src/H5detect.c | 47 +- src/H5public.h | 4 +- src/Makefile.in | 2 +- test/CMakeTests.cmake | 2 + test/Makefile.am | 2 +- test/Makefile.in | 2 +- test/accum.c | 8 +- test/big.c | 320 ++++---- test/cmpd_dset.c | 32 +- test/dsets.c | 10 +- test/dt_arith.c | 74 +- test/dtypes.c | 81 +- test/h5test.c | 2 +- test/ntypes.c | 4 +- test/tarray.c | 28 +- test/tattr.c | 2 +- test/test_plugin.sh.in | 3 +- test/tfile.c | 34 + test/tgenprop.c | 6 +- test/tid.c | 14 +- test/tmisc.c | 2 +- test/trefer.c | 40 +- test/tselect.c | 36 +- test/tsohm.c | 4 +- test/ttsafe_acreate.c | 4 +- test/ttsafe_cancel.c | 4 +- test/tunicode.c | 4 +- testpar/t_coll_chunk.c | 10 +- testpar/t_dset.c | 130 +-- testpar/t_filter_read.c | 4 +- testpar/t_mpi.c | 2 +- testpar/t_posix_compliant.c | 32 +- tools/h5copy/h5copygentest.c | 12 +- tools/h5copy/testh5copy.sh.in | 17 + tools/h5diff/h5diff_common.c | 2 +- tools/h5diff/h5diffgentest.c | 22 +- tools/h5diff/testh5diff.sh.in | 17 + tools/h5dump/CMakeTests.cmake | 10 + tools/h5dump/h5dumpgentest.c | 501 ++++++++++++ tools/h5dump/testh5dump.sh.in | 17 +- tools/h5dump/testh5dumppbits.sh.in | 17 +- tools/h5dump/testh5dumpxml.sh.in | 16 + tools/h5import/CMakeTests.cmake | 23 +- tools/h5import/Makefile.am | 3 + tools/h5import/Makefile.in | 4 +- tools/h5import/h5importtestutil.sh.in | 17 + tools/h5jam/Makefile.am | 2 +- tools/h5jam/Makefile.in | 3 +- tools/h5jam/getub.c | 4 +- tools/h5jam/testh5jam.sh.in | 21 +- tools/h5ls/testh5ls.sh.in | 16 + tools/h5repack/Makefile.am | 2 +- tools/h5repack/Makefile.in | 3 +- tools/h5repack/h5repack.sh.in | 17 + tools/h5repack/h5repack_plugin.sh.in | 19 +- tools/h5repack/h5repacktst.c | 32 +- tools/h5stat/h5stat.c | 8 +- tools/h5stat/testh5stat.sh.in | 17 + tools/misc/h5repart.c | 4 +- tools/misc/talign.c | 10 +- tools/misc/testh5mkgrp.sh.in | 16 + tools/testfiles/tcmpdintarray.ddl | 64 ++ tools/testfiles/tcmpdintarray.h5 | Bin 0 -> 9888 bytes tools/testfiles/tcmpdints.ddl | 1444 +++++++++++++++++++++++++++++++++ tools/testfiles/tcmpdints.h5 | Bin 0 -> 9312 bytes vms/src/h5pubconf.h | 6 +- 110 files changed, 3398 insertions(+), 931 deletions(-) create mode 100644 tools/testfiles/tcmpdintarray.ddl create mode 100644 tools/testfiles/tcmpdintarray.h5 create mode 100644 tools/testfiles/tcmpdints.ddl create mode 100644 tools/testfiles/tcmpdints.h5 diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 18464ac..1a4c2fa 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -200,11 +200,11 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_PACKAGE_VENDOR "HDF_Group") SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") - SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDF5_PACKAGE_NAME}") SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") SET (CPACK_PACKAGE_VERSION_PATCH "") + SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${HDF5_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") SET (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") @@ -215,6 +215,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_GENERATOR "TGZ") IF (WIN32) LIST (APPEND CPACK_GENERATOR "NSIS") + SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${HDF5_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${LIB_TYPE}") SET (CPACK_MONOLITHIC_INSTALL ON) SET (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") @@ -253,7 +254,9 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_DEBIAN_PACKAGE_SECTION "Libraries") SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDF5_PACKAGE_BUGREPORT}") - + +# LIST (APPEND CPACK_GENERATOR "RPM") + SET (CPACK_RPM_PACKAGE_RELEASE "1") SET (CPACK_RPM_COMPONENT_INSTALL ON) SET (CPACK_RPM_PACKAGE_RELOCATABLE ON) SET (CPACK_RPM_PACKAGE_LICENSE "BSD-style") @@ -276,6 +279,12 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) The HDF5 data model, file format, API, library, and tools are open and distributed without charge. " ) + + #----------------------------------------------------------------------------- + # Configure the spec file for the install RPM + #----------------------------------------------------------------------------- +# CONFIGURE_FILE ("${HDF5_RESOURCES_DIR}/hdf5.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec" @ONLY IMMEDIATE) +# SET (CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec") ENDIF (WIN32) INCLUDE(InstallRequiredSystemLibraries) diff --git a/MANIFEST b/MANIFEST index 846ebc0..4afe5b8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -539,11 +539,11 @@ ./perform/sio_timer.h ./perform/zip_perf.c -./release_docs/INSTALL_CMake.txt ./release_docs/COPYING ./release_docs/HISTORY-1_0-1_8_0_rc3.txt ./release_docs/HISTORY-1_9.txt ./release_docs/INSTALL +./release_docs/INSTALL_CMake.txt ./release_docs/INSTALL_Cygwin.txt ./release_docs/INSTALL_parallel ./release_docs/INSTALL_VMS.txt @@ -1510,8 +1510,12 @@ ./tools/testfiles/tcontents.ddl ./tools/testfiles/tcontiguos.ddl ./tools/testfiles/tcmpdattrintsize.ddl +./tools/testfiles/tcmpdintarray.ddl +./tools/testfiles/tcmpdints.ddl ./tools/testfiles/tcmpdintsize.ddl ./tools/testfiles/tcmpdattrintsize.h5 +./tools/testfiles/tcmpdintarray.h5 +./tools/testfiles/tcmpdints.h5 ./tools/testfiles/tcmpdintsize.h5 ./tools/testfiles/tcomp-1.ddl ./tools/testfiles/tcomp-2.ddl diff --git a/README.txt b/README.txt index d0df1bf..992f8f2 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.167-swmr0 currently under development +HDF5 version 1.9.169-swmr0 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 78ea36f..2a39e46 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -469,7 +469,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index f2a10e2..3e4f6d9 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -4,8 +4,21 @@ ### T E S T I N G ### ############################################################################## ############################################################################## +# Remove any output file left over from previous test run +ADD_TEST ( + NAME cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 +) ADD_TEST (NAME cpp_testhdf5 COMMAND $) +SET_TESTS_PROPERTIES (cpp_testhdf5 PROPERTIES DEPENDS cpp_testhdf5-clear-objects) IF (HDF5_TEST_VFD) @@ -25,6 +38,17 @@ IF (HDF5_TEST_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME VFD-${vfdname}-cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 + ) + ADD_TEST ( NAME VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -35,6 +59,7 @@ IF (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) + SET_TESTS_PROPERTIES (VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS VFD-${vfdname}-cpp_testhdf5-clear-objects) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_VFD_TEST) diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am index 687f0ca..3f62bda 100644 --- a/c++/test/Makefile.am +++ b/c++/test/Makefile.am @@ -51,5 +51,8 @@ mostlyclean-local: @if test -d ii_files; then \ $(RM) -rf ii_files; \ fi +# Temporary files +CHECK_CLEANFILES+=tattr_multi.h5 tfattrs.h5 tattr_scalar.h5 tattr_compound.h5 \ + tattr_dtype.h5 tattr_basic.h5 include $(top_srcdir)/config/conclude.am diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 3c4c645..0aad590 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -424,7 +424,10 @@ TRACE = perl $(top_srcdir)/bin/trace # .chkexe files are used to mark tests that have run successfully. # .chklog files are output from those tests. # *.clog are from the MPE option. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog +# Temporary files +CHECK_CLEANFILES = *.chkexe *.chklog *.clog tattr_multi.h5 tfattrs.h5 \ + tattr_scalar.h5 tattr_compound.h5 tattr_dtype.h5 \ + tattr_basic.h5 # Include src, test, and c++/src directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/c++/src diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 28d8a1e..6ae3f82 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -122,9 +122,9 @@ static void test_compound_2() SUBTEST("Compound Element Reordering"); try { // Sizes should be the same, but be careful just in case - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; ia = i*8+0; @@ -190,9 +190,9 @@ static void test_compound_2() } } // Release resources - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -247,9 +247,9 @@ static void test_compound_3() SUBTEST("Compound Datatype Subset Conversions"); try { /* Initialize */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; ia = i*8+0; @@ -312,9 +312,9 @@ static void test_compound_3() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -374,9 +374,9 @@ static void test_compound_4() SUBTEST("Compound Element Shrinking & Reordering"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; ia = i*8+0; @@ -444,9 +444,9 @@ static void test_compound_4() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -499,8 +499,8 @@ static void test_compound_5() src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}}; dst_typ_t *dst; - void *buf = calloc(2, sizeof(dst_typ_t)); - void *bkg = calloc(2, sizeof(dst_typ_t)); + void *buf = HDcalloc(2, sizeof(dst_typ_t)); + void *bkg = HDcalloc(2, sizeof(dst_typ_t)); ArrayType* array_dt = NULL; // Output message about test being performed @@ -552,8 +552,8 @@ static void test_compound_5() { H5_FAILED(); } /* Free memory buffers */ - free(buf); - free(bkg); + HDfree(buf); + HDfree(bkg); dst = NULL; PASSED(); } // end of try block @@ -606,9 +606,9 @@ static void test_compound_6() SUBTEST("Compound Element Growing"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; ib = (i*8+1) & 0x7fff; @@ -645,9 +645,9 @@ static void test_compound_6() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index bef9d77..287fa0f 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -754,7 +754,7 @@ #cmakedefine H5_USING_MEMCHECKER @H5_USING_MEMCHECKER@ /* Version number of package */ -#define VERSION "@HDF5_PACKAGE_VERSION@" +#define H5_VERSION "@HDF5_PACKAGE_VERSION@" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ @@ -781,10 +781,10 @@ #cmakedefine WORDS_BIGENDIAN @H5_WORDS_BIGENDIANR@ /* Number of bits in a file offset, on hosts where this is settable. */ -#cmakedefine _FILE_OFFSET_BITS +#cmakedefine H5__FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ -#cmakedefine _LARGE_FILES +#cmakedefine H5__LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine H5_const diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 699e2d0..c6be9ff 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -11,13 +11,16 @@ set(STATICLIBRARIES "@H5_ENABLE_STATIC_LIB@") set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) set(CTEST_BUILD_CONFIGURATION "Release") +#set(NO_MAC_FORTRAN "true") +#set(BUILD_OPTIONS ""${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_ENABLE_F2003:BOOL=ON) ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### if(WIN32) if(STATICLIBRARIES) - set(BUILD_OPTIONS "-DUSE_SHARED_LIBS:BOOL=OFF") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF") endif(STATICLIBRARIES) set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake/hdf5") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) @@ -25,7 +28,7 @@ if(WIN32) set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) if(STATICLIBRARIES) - set(BUILD_OPTIONS "-DUSE_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") endif(STATICLIBRARIES) set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake/hdf5") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") @@ -48,8 +51,12 @@ if(APPLE) execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) set(ENV{CC} "${XCODE_CC}") set(ENV{CXX} "${XCODE_CXX}") - # Shared fortran is not supported, build static - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + if(NOT NO_MAC_FORTRAN) + # Shared fortran is not supported, build static + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else(NOT NO_MAC_FORTRAN) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + endif(NOT NO_MAC_FORTRAN) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") endif(APPLE) diff --git a/config/lt_vers.am b/config/lt_vers.am index 1037868..7027aaa 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index cdd4696..ff41ef3 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.167-swmr0. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.169-swmr0. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.167-swmr0' -PACKAGE_STRING='HDF5 1.9.167-swmr0' +PACKAGE_VERSION='1.9.169-swmr0' +PACKAGE_STRING='HDF5 1.9.169-swmr0' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1492,7 +1492,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.167-swmr0 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.169-swmr0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1562,7 +1562,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.167-swmr0:";; + short | recursive ) echo "Configuration of HDF5 1.9.169-swmr0:";; esac cat <<\_ACEOF @@ -1761,7 +1761,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.167-swmr0 +HDF5 configure 1.9.169-swmr0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2855,7 +2855,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.167-swmr0, which was +It was created by HDF5 $as_me 1.9.169-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3687,7 +3687,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.167-swmr0' + VERSION='1.9.169-swmr0' cat >>confdefs.h <<_ACEOF @@ -30805,7 +30805,7 @@ if test -n "$cc_version_info"; then fi -## Strip anything that looks like a flag off of $CC +## Strip anything that looks like a flag off of $FC FC_NOFLAGS=`echo $FC | sed 's/ -.*//'` if `echo $FC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then @@ -30824,7 +30824,7 @@ if test -n "$fc_version_info"; then fi -## Strip anything that looks like a flag off of $CC +## Strip anything that looks like a flag off of $CXX CXX_NOFLAGS=`echo $CXX | sed 's/ -.*//'` if `echo $CXX_NOFLAGS | grep ^/ >/dev/null 2>&1`; then @@ -31676,7 +31676,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.167-swmr0 +HDF5 config.lt 1.9.169-swmr0 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33814,7 +33814,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.167-swmr0, which was +This file was extended by HDF5 $as_me 1.9.169-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33880,7 +33880,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.167-swmr0 +HDF5 config.status 1.9.169-swmr0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index a837ca1..5aaf765 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.167-swmr0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.169-swmr0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -4097,7 +4097,7 @@ if test -n "$cc_version_info"; then fi AC_SUBST([FC_VERSION]) -## Strip anything that looks like a flag off of $CC +## Strip anything that looks like a flag off of $FC FC_NOFLAGS=`echo $FC | sed 's/ -.*//'` if `echo $FC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then @@ -4116,7 +4116,7 @@ if test -n "$fc_version_info"; then fi AC_SUBST([CXX_VERSION]) -## Strip anything that looks like a flag off of $CC +## Strip anything that looks like a flag off of $CXX CXX_NOFLAGS=`echo $CXX | sed 's/ -.*//'` if `echo $CXX_NOFLAGS | grep ^/ >/dev/null 2>&1`; then diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 1f896df..58a2858 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -39,6 +39,9 @@ soft_link.h5 subset.h5 unix2win.h5 + blue/prefix_target.h5 + red/prefix_target.h5 + u2w/u2w_target.h5 ) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index d5b201c..aebd39b 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -5,6 +5,30 @@ ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + compound.h5 + copy1.h5 + copy2.h5 + dsetf.h5 + extend.h5 + FORTRAN.h5 + groupf.h5 + groupsf.h5 + h5_cmprss.h5 + mount1.h5 + mount2.h5 + sdsf.h5 + subset.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "f90_ex-clear-objects") + FOREACH (example ${examples}) ADD_TEST (NAME f90_ex_${example} COMMAND $) IF (NOT "${last_test}" STREQUAL "") diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index ab7adf7..deab4f3 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -1582,7 +1582,7 @@ nh5dvlen_get_max_len_c ( hid_t_f *dset_id , hid_t_f *type_id, hid_t_f *space_id num_elem = H5Sget_select_npoints(c_space_id); if( num_elem < 0) return ret_value; - c_buf = (hvl_t *)malloc(sizeof(hvl_t)*(size_t)num_elem); + c_buf = (hvl_t *)HDmalloc(sizeof(hvl_t)*(size_t)num_elem); if (c_buf == NULL) return ret_value; status = H5Dread(c_dset_id, c_type_id, H5S_ALL, c_space_id, H5P_DEFAULT, c_buf); if(status < 0) goto DONE; @@ -1595,7 +1595,7 @@ nh5dvlen_get_max_len_c ( hid_t_f *dset_id , hid_t_f *type_id, hid_t_f *space_id DONE: - free(c_buf); + HDfree(c_buf); return ret_value; } /****if* H5Df/nh5dwrite_vl_integer_c @@ -1651,7 +1651,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_ c_file_space_id = (hid_t)*file_space_id; c_xfer_prp = (hid_t)*xfer_prp; - c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t)); + c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t)); if (c_buf == NULL) return ret_value; tmp = (int_f *)buf; for (i=0; i < num_elem; i++) { @@ -1667,7 +1667,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_ if( status < 0) goto DONE; ret_value = 0; DONE: - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -1725,7 +1725,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s num_elem = H5Sget_select_npoints(c_mem_space_id); if(num_elem != dims[1]) return ret_value; - c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t)); + c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t)); if (c_buf == NULL) return ret_value; /* * Call H5Dread function. @@ -1739,7 +1739,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf); ret_value = 0; DONE: - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -1798,12 +1798,12 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp /* * Allocate arra of character pointers */ - c_buf = (char **)malloc((size_t)num_elem * sizeof(char *)); + c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *)); if (c_buf == NULL) return ret_value; /* Copy data to long C string */ tmp = (char *)HD5f2cstring(buf, (size_t)(max_len*num_elem)); - if (tmp == NULL) { free(c_buf); + if (tmp == NULL) { HDfree(c_buf); return ret_value; } /* @@ -1811,7 +1811,7 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp */ tmp_p = tmp; for (i=0; i < num_elem; i++) { - c_buf[i] = (char *) malloc((size_t)len[i]+1); + c_buf[i] = (char *) HDmalloc((size_t)len[i]+1); memcpy(c_buf[i], tmp_p, (size_t)len[i]); c_buf[i][len[i]] = '\0'; tmp_p = tmp_p + max_len; @@ -1826,8 +1826,8 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp ret_value = 0; DONE: H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf); - free(c_buf); - free(tmp); + HDfree(c_buf); + HDfree(tmp); return ret_value; } /****if* H5Df/nh5dread_vl_string_c @@ -1885,18 +1885,18 @@ nh5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa /* * Allocate array of character pointers */ - c_buf = (char **)malloc((size_t)num_elem * sizeof(char *)); + c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *)); if (c_buf == NULL) return ret_value; /* * Call H5Dread function. */ status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf); - if (status < 0) { free(c_buf); + if (status < 0) { HDfree(c_buf); return ret_value; } /* Copy data to long C string */ - tmp = (char *)malloc((size_t)(max_len*num_elem) +1); + tmp = (char *)HDmalloc((size_t)(max_len*num_elem) +1); tmp_p = tmp; for (i=0; i) +SET_TESTS_PROPERTIES (cpp_hl_ex_ptExampleFL PROPERTIES DEPENDS cpp_hl_ex_ptExampleFL-clear-objects) diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 850339c..9daaccc 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -460,7 +460,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 36c799d..a9c5258 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -6,7 +6,7 @@ PROJECT (HDF5_HL_EXAMPLES ) #----------------------------------------------------------------------------- SET (examples ex_lite1 - ex_lite2 + ex_lite2 #ex_lite2 PROPERTIES DEPENDS ex_lite1) ex_lite3 ptExampleFL ex_image1 diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index e1ccba0..0f9ca11 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -21,8 +21,40 @@ FOREACH (h5_file ${HDF5_TEST_FILES}) ) ENDFOREACH (h5_file ${HDF5_TEST_FILES}) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME hl_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ex_lite1.h5 + ex_lite2.h5 + ex_lite3.h5 + packet_table_FLexample.h5 + ex_image1.h5 + ex_image2.h5 + ex_table_01.h5 + ex_table_02.h5 + ex_table_03.h5 + ex_table_04.h5 + ex_table_05.h5 + ex_table_06.h5 + ex_table_07.h5 + ex_table_08.h5 + ex_table_09.h5 + ex_table_10.h5 + ex_table_11.h5 + ex_table_12.h5 + ex_ds1.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_ex-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "hl_ex-clear-objects") + FOREACH (example ${examples}) ADD_TEST (NAME hl_ex_${example} COMMAND $) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_ex_${example} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "hl_ex_${example}") ENDFOREACH (example ${examples}) - -SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 22a7a3e..b4ea067 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -505,7 +505,7 @@ herr_t H5IM_get_palette(hid_t loc_id, dim_ref = n_refs; - refbuf = malloc(sizeof(hobj_ref_t) * (int)dim_ref); + refbuf = HDmalloc(sizeof(hobj_ref_t) * (int)dim_ref); if(H5Aread(attr_id, attr_type, refbuf) < 0) goto out; @@ -525,7 +525,7 @@ herr_t H5IM_get_palette(hid_t loc_id, if(H5Dclose(pal_id) < 0) goto out; - free(refbuf); + HDfree(refbuf); } /* H5T_REFERENCE */ diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index 818096e..39cb990 100644 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -75,7 +75,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; @@ -135,7 +135,7 @@ nh5imread_image_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -206,9 +206,9 @@ nh5immake_image_24bit_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_il!=NULL) - free(c_il); + HDfree(c_il); return ret_value; } @@ -265,7 +265,7 @@ nh5imget_image_info_c(hid_t_f *loc_id, /* * allocate buffer to hold name of an attribute */ - if ((c_buf = malloc((size_t)*ilen +1)) == NULL) + if ((c_buf = HDmalloc((size_t)*ilen +1)) == NULL) goto done; /* @@ -292,9 +292,9 @@ nh5imget_image_info_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_buf!=NULL) - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -344,7 +344,7 @@ nh5imis_image_c(hid_t_f *loc_id, ret = H5IMis_image(c_loc_id, c_name); if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret; @@ -467,9 +467,9 @@ nh5imlink_palette_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_namepal!=NULL) - free(c_namepal); + HDfree(c_namepal); return ret_value; } @@ -537,9 +537,9 @@ nh5imunlink_palette_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_namepal!=NULL) - free(c_namepal); + HDfree(c_namepal); return ret_value; } @@ -602,7 +602,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -672,7 +672,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -733,7 +733,7 @@ nh5imget_palette_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -783,7 +783,7 @@ nh5imis_palette_c(hid_t_f *loc_id, ret = H5IMis_palette(c_loc_id, c_name); if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret; diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 674636d..4f8f7b6 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -64,7 +64,7 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, if (c_name == NULL) goto done; - c_dims = malloc(sizeof(hsize_t) * (*rank )); + c_dims = HDmalloc(sizeof(hsize_t) * (*rank )); if (c_dims == NULL) goto done; @@ -91,9 +91,9 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_dims!=NULL) - free(c_dims); + HDfree(c_dims); return ret_value; } @@ -616,7 +616,7 @@ nh5ltread_dataset_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -1102,9 +1102,9 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_buf!=NULL) - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -1163,7 +1163,7 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -1242,9 +1242,9 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -1314,9 +1314,9 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -1388,9 +1388,9 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -1467,11 +1467,11 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); if(c_buf!=NULL) - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -1545,9 +1545,9 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; @@ -1616,9 +1616,9 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -1686,9 +1686,9 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -1762,11 +1762,11 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); if(c_buf!=NULL) - free(c_buf); + HDfree(c_buf); return ret_value; } @@ -1828,7 +1828,7 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -1878,7 +1878,7 @@ nh5ltfind_dataset_c(hid_t_f *loc_id, ret = H5LTfind_dataset(c_loc_id, c_name); if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret; @@ -1960,7 +1960,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); return ret_value; } @@ -2030,9 +2030,9 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; } @@ -2123,9 +2123,9 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, done: if(c_name!=NULL) - free(c_name); + HDfree(c_name); if(c_attrname!=NULL) - free(c_attrname); + HDfree(c_attrname); return ret_value; @@ -2177,7 +2177,7 @@ nh5ltpath_valid_c(hid_t_f *loc_id, done: if(c_path != NULL) - free(c_path); + HDfree(c_path); return (int_f)ret; } diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 89ed0ff..860aa09 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -476,7 +476,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 96209aa..81253bd 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -15,8 +15,9 @@ ADD_TEST ( dsetf3.h5 dsetf4.h5 dsetf5.h5 - f1image.h5 + f1img.h5 f1tab.h5 + tstds.h5 ) ADD_TEST (NAME hl_f90_tstds COMMAND $) diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index cd281b7..fa3a803 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -45,7 +45,7 @@ tstimage_SOURCES=tstimage.f90 tsttable_SOURCES=tsttable.f90 # Temporary files. -CHECK_CLEANFILES+=dsetf[1-4].h5 f1img.h5 f1tab.h5 tstds.h5 +CHECK_CLEANFILES+=dsetf[1-5].h5 f1img.h5 f1tab.h5 tstds.h5 # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 5d576d0..024cb0f 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -436,7 +436,7 @@ TRACE = perl $(top_srcdir)/bin/trace # *.clog are from the MPE option. # Temporary files. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog dsetf[1-4].h5 f1img.h5 \ +CHECK_CLEANFILES = *.chkexe *.chklog *.clog dsetf[1-5].h5 f1img.h5 \ f1tab.h5 tstds.h5 # Our main target, the test programs diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 5f8cd50..06ce078 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -254,7 +254,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -265,7 +265,7 @@ herr_t H5DSattach_scale(hid_t did, /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; - buf[idx].p = malloc( 1 * sizeof(hobj_ref_t)); + buf[idx].p = HDmalloc( 1 * sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; /* write the attribute with the reference */ @@ -282,7 +282,7 @@ herr_t H5DSattach_scale(hid_t did, if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } @@ -303,7 +303,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -343,13 +343,13 @@ herr_t H5DSattach_scale(hid_t did, if(buf[idx].len > 0) { buf[idx].len++; len = buf[idx].len; - buf[idx].p = realloc(buf[idx].p, len * sizeof(hobj_ref_t)); + buf[idx].p = HDrealloc(buf[idx].p, len * sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[len - 1] = ref_to_ds; } /* end if */ else { /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; - buf[idx].p = malloc(sizeof(hobj_ref_t)); + buf[idx].p = HDmalloc(sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; } /* end else */ } /* end if */ @@ -367,7 +367,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -447,7 +447,7 @@ herr_t H5DSattach_scale(hid_t did, nelmts++; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if(dsbuf == NULL) goto out; @@ -497,7 +497,7 @@ herr_t H5DSattach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } /* has_reflist */ @@ -519,9 +519,9 @@ herr_t H5DSattach_scale(hid_t did, /* error zone */ out: if(buf) - free(buf); + HDfree(buf); if(dsbuf) - free(dsbuf); + HDfree(dsbuf); H5E_BEGIN_TRY { H5Sclose(sid); @@ -673,7 +673,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -718,7 +718,7 @@ herr_t H5DSdetach_scale(hid_t did, ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { - free(buf[idx].p); + HDfree(buf[idx].p); buf[idx].p = NULL; } /* Since a reference to a dim. scale can be inserted only once, @@ -760,7 +760,7 @@ herr_t H5DSdetach_scale(hid_t did, if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; @@ -786,7 +786,7 @@ herr_t H5DSdetach_scale(hid_t did, if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if(dsbuf == NULL) goto out; @@ -876,7 +876,7 @@ herr_t H5DSdetach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; return SUCCEED; @@ -890,7 +890,7 @@ out: H5Tclose(tid); if(dsbuf) { - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } if(buf) { @@ -898,9 +898,9 @@ out: free the pointers allocated when we read data in */ for(i = 0; i < rank; i++) { if(buf[i].p) - free(buf[i].p); + HDfree(buf[i].p); } - free(buf); + HDfree(buf); buf = NULL; } } H5E_END_TRY; @@ -1033,7 +1033,7 @@ htri_t H5DSis_attached(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -1079,7 +1079,7 @@ htri_t H5DSis_attached(hid_t did, goto out; if (H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -1116,7 +1116,7 @@ htri_t H5DSis_attached(hid_t did, if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbuf == NULL) goto out; @@ -1170,7 +1170,7 @@ htri_t H5DSis_attached(hid_t did, if (H5Aclose(aid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } /* has_reflist */ @@ -1189,11 +1189,11 @@ out: } H5E_END_TRY; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } if(dsbuf) { - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } return FAIL; @@ -1317,7 +1317,7 @@ herr_t H5DSiterate_scales(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -1380,7 +1380,7 @@ herr_t H5DSiterate_scales(hid_t did, if (H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* if has_dimlist */ @@ -1390,7 +1390,7 @@ out: H5E_BEGIN_TRY { if(buf) { H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf); - free(buf); + HDfree(buf); } H5Sclose(sid); H5Aclose(aid); @@ -1489,7 +1489,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; /* allocate and initialize */ - buf = (const char **) malloc((size_t) rank * sizeof(char *)); + buf = (const char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1513,7 +1513,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } } @@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; /* allocate and initialize */ - buf = (const char **) malloc((size_t) rank * sizeof(char *)); + buf = (const char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1543,7 +1543,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* free the ptr that will be replaced by label */ if (buf[idx]) - free((void *)buf[idx]); + HDfree((void *)buf[idx]); /* store the label information in the required index */ buf[idx] = label; @@ -1559,7 +1559,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - free((void *)buf[i]); + HDfree((void *)buf[i]); } /* close */ @@ -1569,7 +1569,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } } @@ -1586,9 +1586,9 @@ out: for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - free((void *)buf[i]); + HDfree((void *)buf[i]); } - free(buf); + HDfree(buf); } H5E_BEGIN_TRY { @@ -1692,7 +1692,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) goto out; /* allocate and initialize */ - buf = (char **) malloc((size_t) rank * sizeof(char *)); + buf = (char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1724,7 +1724,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + HDfree(buf[i]); } /* close */ @@ -1734,7 +1734,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } @@ -1748,9 +1748,9 @@ out: for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + HDfree(buf[i]); } - free(buf); + HDfree(buf); } H5E_BEGIN_TRY { @@ -1845,7 +1845,7 @@ ssize_t H5DSget_scale_name(hid_t did, goto out; /* allocate a temporary buffer */ - buf = (char*)malloc(nbytes * sizeof(char)); + buf = (char*)HDmalloc(nbytes * sizeof(char)); if (buf == NULL) goto out; @@ -1872,7 +1872,7 @@ ssize_t H5DSget_scale_name(hid_t did, if (H5Sclose(sid) < 0) goto out; if (buf) - free(buf); + HDfree(buf); return (ssize_t)(nbytes - 1); @@ -1884,7 +1884,7 @@ out: H5Sclose(sid); } H5E_END_TRY; if (buf) - free(buf); + HDfree(buf); return FAIL; } @@ -2052,7 +2052,7 @@ int H5DSget_num_scales(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -2071,7 +2071,7 @@ int H5DSget_num_scales(hid_t did, goto out; if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -2086,7 +2086,7 @@ out: } H5E_END_TRY; if(buf) - free(buf); + HDfree(buf); return FAIL; } diff --git a/hl/src/H5HLprivate2.h b/hl/src/H5HLprivate2.h index 556c86f..1b67c70 100644 --- a/hl/src/H5HLprivate2.h +++ b/hl/src/H5HLprivate2.h @@ -22,98 +22,8 @@ /* Public High-Level header */ #include "hdf5_hl.h" -/* The following is copied from src/H5private.h */ - -/* - * Status return values for the `herr_t' type. - * Since some unix/c routines use 0 and -1 (or more precisely, non-negative - * vs. negative) as their return code, and some assumption had been made in - * the code about that, it is important to keep these constants the same - * values. When checking the success or failure of an integer-valued - * function, remember to compare against zero and not one of these two - * values. - */ -#define SUCCEED 0 -#define FAIL (-1) -#define UFAIL (unsigned)(-1) - -/* minimum of two, three, or four values */ -#undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#define MIN2(a,b) MIN(a,b) -#define MIN3(a,b,c) MIN(a,MIN(b,c)) -#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) - -/* maximum of two, three, or four values */ -#undef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#define MAX2(a,b) MAX(a,b) -#define MAX3(a,b,c) MAX(a,MAX(b,c)) -#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) - -/* - * HDF Boolean type. - */ -#ifndef FALSE -# define FALSE 0 -#endif -#ifndef TRUE -# define TRUE 1 -#endif -#ifndef HDassert - #define HDassert(X) assert(X) -#endif /* HDassert */ -#ifndef HDcalloc - #define HDcalloc(N,Z) calloc(N,Z) -#endif /* HDcalloc */ -#ifndef HDfflush - #define HDfflush(F) fflush(F) -#endif /* HDfflush */ -H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); -#ifndef HDfree - #define HDfree(M) free(M) -#endif /* HDfree */ -#ifndef HDmemcpy - #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) -#endif /* HDmemcpy */ -#ifndef HDmemset - #define HDmemset(X,C,Z) memset(X,C,Z) -#endif /* HDmemset */ -#ifndef HDrealloc - #define HDrealloc(M,Z) realloc(M,Z) -#endif /* HDrealloc */ -#ifndef HDsleep - #define HDsleep(N) sleep(N) -#endif /* HDsleep */ -#ifndef HDstrcat - #define HDstrcat(X,Y) strcat(X,Y) -#endif /* HDstrcat */ -#ifndef HDstrcmp - #define HDstrcmp(X,Y) strcmp(X,Y) -#endif /* HDstrcmp */ -#ifndef HDstrlen - #define HDstrlen(S) strlen(S) -#endif /* HDstrlen */ -#ifndef HDstrrchr - #define HDstrrchr(S,C) strrchr(S,C) -#endif /* HDstrrchr */ -#ifndef HDstrtod - #define HDstrtod(S,R) strtod(S,R) -#endif /* HDstrtod */ -#ifndef HDstrtol - #define HDstrtol(S,R,N) strtol(S,R,N) -#endif /* HDstrtol */ -/* - * And now for a couple non-Posix functions... Watch out for systems that - * define these in terms of macros. - */ -#if !defined strdup && !defined H5_HAVE_STRDUP -extern char *strdup(const char *s); -#endif - -#ifndef HDstrdup - #define HDstrdup(S) strdup(S) -#endif /* HDstrdup */ +/* HDF5 private functions */ +#include "H5private.h" #endif /* _H5HLprivate2_H */ diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index e55aaf8..9c7c7e8 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -594,7 +594,7 @@ herr_t H5IMlink_palette( hid_t loc_id, dim_ref = n_refs + 1; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -635,7 +635,7 @@ herr_t H5IMlink_palette( hid_t loc_id, if(H5Aclose(aid) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } /* ok_pal == 1 */ @@ -901,7 +901,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, dim_ref = n_refs; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -930,7 +930,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, goto out; if ( H5Aclose( aid ) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } @@ -1012,7 +1012,7 @@ herr_t H5IMget_palette( hid_t loc_id, dim_ref = n_refs; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -1034,7 +1034,7 @@ herr_t H5IMget_palette( hid_t loc_id, goto out; if ( H5Aclose( aid ) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } /* Close the image dataset. */ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 98f2ff2..d175099 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -13,13 +13,12 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include #include +#include +#include #include "H5LTprivate.h" -#include "H5private.h" /* For Lex and Yacc */ #define COL 3 diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 92b041a..d3a03cd 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -13,9 +13,10 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "H5PTprivate.h" #include "H5TBprivate.h" -#include /* Packet Table private data */ @@ -33,6 +34,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT; #define H5PT_HASH_TABLE_SIZE 64 /* Packet Table private functions */ +static herr_t H5PT_free_id(void *id); static herr_t H5PT_close( htbl_t* table ); static herr_t H5PT_create_index(htbl_t *table_id); static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index); @@ -84,11 +86,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id, /* Register the packet table ID type if this is the first table created */ if(H5PT_ptable_id_type < 0) - if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0) + if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) goto out; /* Get memory for the table identifier */ - table = (htbl_t *)malloc(sizeof(htbl_t)); + table = (htbl_t *)HDmalloc(sizeof(htbl_t)); /* Create a simple data space with unlimited size */ dims[0] = 0; @@ -142,7 +144,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id, H5Pclose(plist_id); H5Dclose(dset_id); if(table) - free(table); + HDfree(table); H5E_END_TRY return H5I_INVALID_HID; } @@ -232,10 +234,10 @@ hid_t H5PTopen( hid_t loc_id, /* Register the packet table ID type if this is the first table created */ if( H5PT_ptable_id_type < 0) - if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0) + if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) goto out; - table = (htbl_t *)malloc(sizeof(htbl_t)); + table = (htbl_t *)HDmalloc(sizeof(htbl_t)); if ( table == NULL ) { goto out; @@ -291,12 +293,26 @@ out: { H5Dclose(table->dset_id); H5Tclose(table->type_id); - free(table); + HDfree(table); } H5E_END_TRY return H5I_INVALID_HID; } +/*------------------------------------------------------------------------- + * Function: H5PT_free_id + * + * Purpose: Free an id. Callback for H5Iregister_type. + * + * Return: Success: 0, Failure: N/A + *------------------------------------------------------------------------- + */ +static herr_t +H5PT_free_id(void *id) +{ + HDfree(id); + return 0; +} /*------------------------------------------------------------------------- * Function: H5PT_close @@ -331,7 +347,7 @@ H5PT_close( htbl_t* table) if(H5Tclose(table->type_id) < 0) goto out; - free(table); + HDfree(table); return 0; @@ -342,7 +358,7 @@ out: H5Dclose(table->dset_id); H5Tclose(table->type_id); H5E_END_TRY - free(table); + HDfree(table); } return -1; } diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 0b6305b..1547e00 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -15,7 +15,7 @@ #include #include -#include "H5private.h" + #include "H5LTprivate.h" #include "H5TBprivate.h" @@ -196,7 +196,7 @@ herr_t H5TBmake_table( const char *table_title, if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) goto out; - free( member_name ); + HDfree( member_name ); } @@ -234,7 +234,7 @@ herr_t H5TBmake_table( const char *table_title, if (H5Aclose(attr_id) < 0) goto out; - free(member_name); + HDfree(member_name); } /* terminate access to the data space. */ @@ -570,7 +570,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, goto out; } - free( member_name ); + HDfree( member_name ); } @@ -734,7 +734,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, if(H5Tclose( nmtype_id ) < 0) goto out; - free( member_name ); + HDfree( member_name ); } @@ -1059,7 +1059,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; j++; } - free( member_name ); + HDfree( member_name ); } /* get the dataspace handle */ @@ -1221,7 +1221,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, if (H5Tclose( nmtype_id ) < 0) goto out; - free( member_name ); + HDfree( member_name ); } /* get the dataspace handle */ @@ -1328,9 +1328,9 @@ herr_t H5TBdelete_record( hid_t loc_id, if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0) goto out; - if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; - if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; /* get field info */ @@ -1351,7 +1351,7 @@ herr_t H5TBdelete_record( hid_t loc_id, if ( read_nrecords ) { - if(NULL == (tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size ))) + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, src_size ))) goto out; /* read the records after the deleted one(s) */ @@ -1415,22 +1415,22 @@ herr_t H5TBdelete_record( hid_t loc_id, goto out; if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); return 0; /* error zone */ out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); H5E_BEGIN_TRY { H5Tclose(mem_type_id); @@ -1509,7 +1509,7 @@ herr_t H5TBinsert_record( hid_t loc_id, goto out; read_nrecords = ntotal_records - start; - tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, type_size); + tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, type_size); /* read the records after the inserted one(s) */ if (H5TBread_records( loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes, tmp_buf ) < 0) @@ -1585,7 +1585,7 @@ herr_t H5TBinsert_record( hid_t loc_id, if (H5Dclose( did ) < 0) return -1; - free( tmp_buf ); + HDfree( tmp_buf ); return 0; @@ -1652,9 +1652,9 @@ herr_t H5TBadd_records_from( hid_t loc_id, if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0) goto out; - if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; - if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; /* get field info */ @@ -1682,7 +1682,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, if (( type_size1 = H5Tget_size( tid_1 )) == 0 ) goto out; - if(NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 ))) + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1 ))) goto out; /* define a hyperslab in the dataset of the size of the records */ @@ -1721,22 +1721,22 @@ herr_t H5TBadd_records_from( hid_t loc_id, goto out; if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); return 0; /* error zone */ out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); H5E_BEGIN_TRY { H5Dclose(did_1); @@ -1998,7 +1998,7 @@ herr_t H5TBcombine_tables(hid_t loc_id1, did_1 = H5I_BADID; /* Release resources. */ - free(tmp_buf); + HDfree(tmp_buf); tmp_buf = NULL; /*------------------------------------------------------------------------- @@ -2100,13 +2100,13 @@ herr_t H5TBcombine_tables(hid_t loc_id1, out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(tmp_fill_buf) - free(tmp_fill_buf); + HDfree(tmp_fill_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); H5E_BEGIN_TRY { if(member_type_id > 0) @@ -2254,7 +2254,7 @@ herr_t H5TBinsert_field( hid_t loc_id, goto out; /* alloc fill value attribute buffer */ - tmp_fill_buf = (unsigned char *)malloc(total_size ); + tmp_fill_buf = (unsigned char *)HDmalloc(total_size ); /* get the fill value attributes */ if ((H5TBAget_fill( loc_id, dset_name, did_1, tmp_fill_buf )) < 0) @@ -2314,7 +2314,7 @@ herr_t H5TBinsert_field( hid_t loc_id, curr_offset += member_size; - free( member_name ); + HDfree( member_name ); /* close the member type */ if(H5Tclose( member_type_id ) < 0) @@ -2349,7 +2349,7 @@ herr_t H5TBinsert_field( hid_t loc_id, *------------------------------------------------------------------------- */ - tmp_buf = (unsigned char *)calloc((size_t)nrecords, (size_t)total_size); + tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size); /* define a hyperslab in the dataset of the size of the records */ offset[0] = 0; @@ -2557,8 +2557,8 @@ herr_t H5TBinsert_field( hid_t loc_id, goto out; /* release resources. */ - free ( tmp_buf ); - free ( tmp_fill_buf ); + HDfree ( tmp_buf ); + HDfree ( tmp_fill_buf ); return 0; @@ -2694,13 +2694,13 @@ herr_t H5TBdelete_field( hid_t loc_id, if (H5Tclose( member_type_id ) < 0) goto out; - free( member_name ); + HDfree( member_name ); break; } - free( member_name ); + HDfree( member_name ); } /* i */ @@ -2722,7 +2722,7 @@ herr_t H5TBdelete_field( hid_t loc_id, curr_offset = 0; /* alloc fill value attribute buffer */ - tmp_fill_buf = (unsigned char *)malloc((size_t) type_size2 ); + tmp_fill_buf = (unsigned char *)HDmalloc((size_t) type_size2 ); /*------------------------------------------------------------------------- * get attributes from previous table in the process @@ -2742,7 +2742,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* we want to skip the field to delete */ if (H5TB_find_field( member_name, field_name ) > 0 ) { - free( member_name ); + HDfree( member_name ); continue; } @@ -2780,7 +2780,7 @@ herr_t H5TBdelete_field( hid_t loc_id, curr_offset += member_size; - free(member_name); + HDfree(member_name); /* close the member type */ if (H5Tclose(member_type_id) < 0) @@ -2821,7 +2821,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* skip the field to delete */ if (H5TB_find_field(member_name, field_name) > 0) { - free(member_name); + HDfree(member_name); continue; } @@ -2840,7 +2840,7 @@ herr_t H5TBdelete_field( hid_t loc_id, if (H5Tinsert( read_type_id, member_name, (size_t)0, member_type_id ) < 0) goto out; - tmp_buf = (unsigned char *)calloc((size_t) nrecords, member_size ); + tmp_buf = (unsigned char *)HDcalloc((size_t) nrecords, member_size ); /* read */ if (H5Dread( did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0) @@ -2881,8 +2881,8 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; /* release resources. */ - free( member_name ); - free ( tmp_buf ); + HDfree( member_name ); + HDfree ( tmp_buf ); } /* i */ @@ -3007,7 +3007,7 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; /* Release resources. */ - free ( tmp_fill_buf ); + HDfree ( tmp_fill_buf ); return 0; @@ -3101,7 +3101,7 @@ htri_t H5TBAget_fill(hid_t loc_id, if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) return -1; - src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)); + src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)); if (src_offset == NULL ) return -1; @@ -3130,12 +3130,12 @@ htri_t H5TBAget_fill(hid_t loc_id, } - free( src_offset ); + HDfree( src_offset ); return has_fill; out: - free( src_offset ); + HDfree( src_offset ); return -1; } @@ -3306,7 +3306,7 @@ herr_t H5TBget_field_info( hid_t loc_id, member_name = H5Tget_member_name(tid, (unsigned)i); strcpy(field_names[i], member_name); - free(member_name); + HDfree(member_name); } /* end if */ /* get the member type */ @@ -3459,7 +3459,7 @@ herr_t H5TB_attach_attributes( const char *table_title, if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) goto out; - free( member_name ); + HDfree( member_name ); } @@ -3508,14 +3508,14 @@ hid_t H5TB_create_type(hid_t loc_id, if (H5TBget_table_info(loc_id,dset_name,&nfields,NULL) < 0) return -1; - if ((fnames = (char**) malloc(sizeof(char*)*(size_t)nfields))==NULL) + if ((fnames = (char**) HDmalloc(sizeof(char*)*(size_t)nfields))==NULL) return -1; for ( i = 0; i < nfields; i++) { - if ((fnames[i] = (char*) malloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL) + if ((fnames[i] = (char*) HDmalloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL) { - free(fnames); + HDfree(fnames); return -1; } } @@ -3551,9 +3551,9 @@ hid_t H5TB_create_type(hid_t loc_id, for ( i=0; i= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)malloc((size_t)name_len * sizeof (char)); + name_out = (char*)HDmalloc((size_t)name_len * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) { if(strcmp(scalename,name_out)==0) { ret_value = SUCCEED; } - free(name_out); + HDfree(name_out); name_out=NULL; } } diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index 9a0ffb0..08d1c46 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -176,7 +176,7 @@ test_direct_chunk_write (hid_t file) direct_buf[i][j] = n++; /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); + outbuf = HDmalloc(z_dst_nbytes); z_dst = (Bytef *)outbuf; /* Perform compression from the source to the destination buffer */ @@ -206,7 +206,7 @@ test_direct_chunk_write (hid_t file) } if(outbuf) - free(outbuf); + HDfree(outbuf); if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) goto error; @@ -249,7 +249,7 @@ test_direct_chunk_write (hid_t file) direct_buf[i][j] = i + j; /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); + outbuf = HDmalloc(z_dst_nbytes); z_dst = (Bytef *)outbuf; /* Perform compression from the source to the destination buffer */ @@ -280,7 +280,7 @@ test_direct_chunk_write (hid_t file) } if(outbuf) - free(outbuf); + HDfree(outbuf); if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) goto error; @@ -329,7 +329,7 @@ error: } H5E_END_TRY; if(outbuf) - free(outbuf); + HDfree(outbuf); return 1; } diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 9729421..831fa23 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -77,23 +77,23 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array of pointers for each of the open images */ - if (NULL == (buf_ptr = (void **)malloc(sizeof(void *) * open_images))) + if (NULL == (buf_ptr = (void **)HDmalloc(sizeof(void *) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the name of each of the open images */ - if (NULL == (filename = (char **)malloc(sizeof(char *) * open_images))) + if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the size of each of the open images */ - if (NULL == (buf_size = (ssize_t *)malloc(sizeof(ssize_t) * open_images))) + if (NULL == (buf_size = (ssize_t *)HDmalloc(sizeof(ssize_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array for each of the file identifiers */ - if (NULL == (file_id = (hid_t *)malloc(sizeof(hid_t) * open_images))) + if (NULL == (file_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array for each of the dataset identifiers */ - if (NULL == (dset_id = (hid_t *)malloc(sizeof(hid_t) * open_images))) + if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); TESTING("get file images"); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index fa6d9e0..da441e70 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.167-swmr0 currently under development +HDF5 version 1.9.169-swmr0 currently under development INTRODUCTION diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 33c43a3..4dae021 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -1,12 +1,81 @@ -The compressed examples file, located in the HDF5 install folder, -can be built and tested with CMake and the supplied -HDF518_Examples.cmake file. It is recommended that you copy those -two files to your development location before continuing. - -The command line to be used is shown at the top of the file. Also, -the location of the HDF5 installation should be verified and -changed if necessary. - -When executed, the ctest script will save the results to the log file -indicated by the ctest command. If you wish the to see more build -and test information, add "-VV" to the ctest command. +************************************************************************ +* Build and Test HDF5 Examples with CMake * +************************************************************************ + +Notes: This short instruction is written for users who want to quickly + test the installation of HDF5 by using the CMake tools to build + and test the HDF5 Examples. The following instructions will show + the default usage and then present common changes for non-default + installations. + For more information, see the USING_HDF5_CMake.txt file. + + More information about using CMake can be found at the KitWare + site, www.cmake.org. + + CMake uses the command line and these instructions use the script + method of the ctest command. + + +======================================================================== +I. Preconditions +======================================================================== + + 1. We suggest you obtain the latest CMake for windows from the Kitware + web site. The HDF5 1.8.x product requires a minimum CMake version + of 2.8.10. + + 2. You have installed the HDF5 library built with CMake, by executing + the HDF Install Utility (the *.exe file in the binary package for + Windows or the *.sh on Linux). If you are using a Windows platform, + you can obtain a pre-built Windows binary from The HDF Group's website + at www.hdfgroup.org. See Section "III. Common changes to the + HDF518_Examples.cmake file", for the line to change the location. + + 3. On Windows, you have installed the 7Zip package. See Section "III. + Common changes to the HDF518_Examples.cmake file", for the line to + change the command. + + + +======================================================================== +II. Building HDF5 Examples with CMake +======================================================================== + +Files in the HDF5 install directory: + HDF5Examples-0.1.1-Source.zip (or HDF5Examples-0.1.1-Source.tar.gz) + HDF518_Examples.cmake + +Default installation process: + Create a directory to run the examples, i.e. \test_hdf5. + Copy HDF5Examples-0.1.1-Source.zip(.tar.gz) to this directory, do NOT unzip. + Copy HDF518_Examples.cmake to this directory. + Edit line 8 of the HDF518_Examples.cmake file and change the INSTALLDIR + to the HDF5 install location. + + Execute from this directory: + ctest -S HDF518_Examples.cmake,HDF5Examples-0.1.1-Source -C Release -O test.log + +The script will uncompress the examples file HDF5Examples-0.1.1-Source.zip(.tar.gz), + and create a build directory inside the HDF5Examples-0.1.1-Source directory. + It will then configure, build, and execute the examples. All the log files + will be found under the build\Testing\Temporary directory, check these for + errors. + +The amount of script information can be increased by adding -V to the ctest + command. Even more information can be shown by adding -VV instead of -V. + + +======================================================================== +III. Common changes to the HDF518_Examples.cmake file +======================================================================== + +Line 8: change the INSTALLDIR to a different HDF5 install location. + +Line 14: uncomment to allow Mac machines to build shared examples. + +Line 15: uncomment to not build and test Fortran examples. + +Line 16: uncomment to build and test Fortran examples with F2003 option. + +Line 68: change the CTEST_7Z_COMMAND to a different unzip program. + diff --git a/src/H5F.c b/src/H5F.c index 90163c5..31c0415 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -63,7 +63,7 @@ typedef struct H5F_olist_t { } ptr; } file_info; size_t list_index; /* Current index in open ID array */ - size_t max_index; /* Maximum # of IDs to put into array */ + size_t max_nobjs; /* Maximum # of IDs to put into array */ } H5F_olist_t; @@ -506,7 +506,8 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") - HDassert(oid_list); + if(!oid_list) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL") /* Perform the query */ if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) @@ -565,7 +566,7 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) +H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) { size_t obj_id_count=0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ @@ -577,10 +578,10 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_ HDassert(obj_id_count_ptr); /* Set up search information */ - olist.obj_id_list = (max_index==0 ? NULL : obj_id_list); + olist.obj_id_list = (max_nobjs==0 ? NULL : obj_id_list); olist.obj_id_count = &obj_id_count; olist.list_index = 0; - olist.max_index = max_index; + olist.max_nobjs = max_nobjs; /* Determine if we are searching for local or global objects */ if(types & H5F_OBJ_LOCAL) { @@ -600,38 +601,54 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") } /* end if */ - /* Search through dataset IDs to count number of datasets, and put their + /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), + * or the caller wants to get the list of IDs and the list isn't full, + * search through dataset IDs to count number of datasets, and put their * IDs on the object list */ - if(types & H5F_OBJ_DATASET) { - olist.obj_type = H5I_DATASET; - if(H5I_iterate(H5I_DATASET, H5F_get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)") - } /* end if */ + if(!olist.max_nobjs || (olist.max_nobjs && olist.list_indexmax_index>0 && olist->list_index>=olist->max_index) - HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ - /* Count file IDs */ if(olist->obj_type == H5I_FILE) { if((olist->file_info.local && (!olist->file_info.ptr.file || (olist->file_info.ptr.file && (H5F_t*)obj_ptr == olist->file_info.ptr.file) )) || (!olist->file_info.local && ( !olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared) ))) { - /* Add the object's ID to the ID list, if appropriate */ - if(olist->obj_id_list) { - olist->obj_id_list[olist->list_index] = obj_id; - olist->list_index++; - } - - /* Increment the number of open objects */ - if(olist->obj_id_count) - (*olist->obj_id_count)++; + add_obj = TRUE; } } /* end if */ else { /* either count opened object IDs or put the IDs on the list */ @@ -726,7 +729,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object") } /* end switch */ if((olist->file_info.local && @@ -737,18 +740,29 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) || (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { - /* Add the object's ID to the ID list, if appropriate */ - if(olist->obj_id_list) { - olist->obj_id_list[olist->list_index] = obj_id; - olist->list_index++; - } /* end if */ - - /* Increment the number of open objects */ - if(olist->obj_id_count) - (*olist->obj_id_count)++; + add_obj = TRUE; } /* end if */ } /* end else */ + if(TRUE==add_obj) { + /* Add the object's ID to the ID list, if appropriate */ + if(olist->obj_id_list) { + olist->obj_id_list[olist->list_index] = obj_id; + olist->list_index++; + } /* end if */ + + /* Increment the number of open objects */ + if(olist->obj_id_count) + (*olist->obj_id_count)++; + + /* Check if we've filled up the array. Return H5_ITER_STOP only if + * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is + * preset to H5_ITER_CONT) because H5I_iterate needs the return value of + * H5_ITER_CONT to continue the iteration. */ + if(olist->max_nobjs>0 && olist->list_index>=olist->max_nobjs) + HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_objects_cb() */ diff --git a/src/H5detect.c b/src/H5detect.c index 3554d50..0f8d051 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -60,9 +60,9 @@ static const char *FileHeader = "\n\ #define MAXDETECT 64 -/* The ALIGNMENT test code may generate the SIGBUS or SIGSEGV signals. We use - * setjmp/longjmp in the signal handlers for recovery. But setjmp/longjmp do - * not necessary restore the signal blocking status while sigsetjmp/siglongjmp +/* The ALIGNMENT test code may generate the SIGBUS, SIGSEGV, or SIGILL signals. + * We use setjmp/longjmp in the signal handlers for recovery. But setjmp/longjmp + * do not necessary restore the signal blocking status while sigsetjmp/siglongjmp * do. If sigsetjmp/siglongjmp are not supported, need to use sigprocmask to * unblock the signal before doing longjmp. */ @@ -139,7 +139,8 @@ static void detect_alignments(void); static size_t align_g[] = {1, 2, 4, 8, 16}; static int align_status_g = 0; /* ALIGNMENT Signal Status */ static int sigbus_handler_called_g = 0; /* how many times called */ -static int sigsegv_handler_called_g = 0; /* how many times called */ +static int sigsegv_handler_called_g = 0;/* how many times called */ +static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) static int verify_signal_handlers(int signum, void (*handler)(int)); @@ -425,6 +426,7 @@ precision (detected_t *d) volatile size_t _ano = 0; \ void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \ void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler);\ + void (*_handler3)(int) = HDsignal(SIGILL, sigill_handler); \ \ _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ if(H5SETJMP(jbuf_g)) _ano++; \ @@ -454,6 +456,7 @@ precision (detected_t *d) HDfree(_buf); \ HDsignal(SIGBUS, _handler); /*restore original handler*/ \ HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ + HDsignal(SIGILL, _handler3); /*restore original handler*/ \ } #else #define ALIGNMENT(TYPE,INFO) { \ @@ -539,6 +542,42 @@ sigbus_handler(int UNUSED signo) #endif +#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) +/*------------------------------------------------------------------------- + * Function: sigill_handler + * + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. + * + * Return: Returns via H5LONGJMP to jbuf_g. + * + * Programmer: Raymond Lu + * 28 October 2013 + * + *------------------------------------------------------------------------- + */ +static void +sigill_handler(int UNUSED signo) +{ +#if !defined(H5HAVE_SIGJMP) && defined(H5_HAVE_SIGPROCMASK) + /* Use sigprocmask to unblock the signal if sigsetjmp/siglongjmp are not */ + /* supported. */ + sigset_t set; + + HDsigemptyset(&set); + HDsigaddset(&set, SIGILL); + HDsigprocmask(SIG_UNBLOCK, &set, NULL); +#endif + + sigill_handler_called_g++; + HDsignal(SIGILL, sigill_handler); + H5LONGJMP(jbuf_g, SIGILL); +} +#endif + + /*------------------------------------------------------------------------- * Function: print_results * diff --git a/src/H5public.h b/src/H5public.h index fad88b1..6496e45 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 167 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 169 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "swmr0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.167-swmr0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.169-swmr0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 104a7ed..ecbcaa1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -523,7 +523,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index b64eeca..58ef1e6 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -142,6 +142,7 @@ ADD_TEST ( COMMAND ${CMAKE_COMMAND} -E remove coord.h5 + dtypes10.h5 sys_file1 tattr.h5 tfile1.h5 @@ -150,6 +151,7 @@ ADD_TEST ( tfile4.h5 tfile5.h5 tfile6.h5 + tfile7.h5 th5o_file th5s1.h5 tselect.h5 diff --git a/test/Makefile.am b/test/Makefile.am index e1c152c..5f814ec 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -139,7 +139,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \ chunk_expand.h5 layout_extend.h5 swmr_fail.h5 partial_chunks.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ - sys_file1 tfile[1-6].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ + sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ diff --git a/test/Makefile.in b/test/Makefile.in index 62a2a7f..ce8c39a 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -955,7 +955,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \ chunk_expand.h5 layout_extend.h5 swmr_fail.h5 \ partial_chunks.h5 copy_dcpl_newfile.h5 extend.h5 istore.h5 \ - extlinks*.h5 frspace.h5 links*.h5 sys_file1 tfile[1-6].h5 \ + extlinks*.h5 frspace.h5 links*.h5 sys_file1 tfile[1-7].h5 \ th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 \ extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2] links.h5 \ links[0-6]*.h5 extlinks[0-15].h5 tmp big.data \ diff --git a/test/accum.c b/test/accum.c index 1a218c6..fc7546d 100644 --- a/test/accum.c +++ b/test/accum.c @@ -1670,9 +1670,9 @@ test_random_write(void) unsigned u; /* Local index variable */ /* Allocate space for the write & read buffers */ - wbuf = (uint8_t *)malloc((size_t)RANDOM_BUF_SIZE); + wbuf = (uint8_t *)HDmalloc((size_t)RANDOM_BUF_SIZE); HDassert(wbuf); - rbuf = (uint8_t *)calloc((size_t)RANDOM_BUF_SIZE, (size_t)1); + rbuf = (uint8_t *)HDcalloc((size_t)RANDOM_BUF_SIZE, 1); HDassert(rbuf); /* Initialize write buffer */ @@ -1690,9 +1690,9 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed); HDsrandom(seed); /* Allocate space for the segment length buffer */ - off = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); + off = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); HDassert(off); - len = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); + len = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); HDassert(len); /* Randomly choose lengths of segments */ diff --git a/test/big.c b/test/big.c index 7465e47..db03c99 100644 --- a/test/big.c +++ b/test/big.c @@ -76,8 +76,6 @@ * NOFILE stands for "no file" to be tested. */ typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NOFILE} fsizes_t; -/* Lists of vfd to test */ -typedef enum vfd_t { SEC2_VFD, STDIO_VFD, FAMILY_VFD } vfd_t; fsizes_t file_size= NOFILE; const char *FILENAME[] = { @@ -91,9 +89,11 @@ int sparse_support=0; /* sparse file supported, default false */ int have_space=0; /* enough space for huge file test, default false */ hsize_t family_size_def=FAMILY_SIZE; /* default family file size */ -/* Protocols */ +/* Prototypes */ static void usage(void); -int testvfd(vfd_t vfd); +static int test_sec2(hid_t fapl); +static int test_stdio(hid_t fapl); +static int test_family(hid_t fapl); /* Array used to record all addresses at which data has been written */ /* so far. Used to prevent overlapping writes. */ @@ -207,66 +207,55 @@ is_sparse(void) *------------------------------------------------------------------------- */ static fsizes_t -supports_big(vfd_t vfd) +supports_big(void) { int fd = -1; fsizes_t fsize = NOFILE; - switch (vfd){ - case FAMILY_VFD: - case SEC2_VFD: - case STDIO_VFD: - if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) - goto error; - - /* Write a few byte at the beginning */ - if (5!=HDwrite(fd, "hello", (size_t)5)) - goto quit; - fsize = SFILE; - - /* Write a few bytes at 2GB */ - if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) - goto quit; - if (5!=HDwrite(fd, "hello", (size_t)5)) - goto quit; - fsize = LFILE; - - /* Write a few bytes at 4GB */ - if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) - goto quit; - if (5!=HDwrite(fd, "hello", (size_t)5)) - goto quit; - fsize = XLFILE; - - /* If this supports sparse_file, write a few bytes at 32GB */ - if (!sparse_support) - goto quit; - if (HDlseek(fd, 32*GB, SEEK_SET) != 32*GB) - goto quit; - if (5!=HDwrite(fd, "hello", (size_t)5)) - goto quit; - fsize = HUGEFILE; - - break; - default: - /* unknown or unsupported VFD */ + if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) goto error; - break; - } + + /* Write a few byte at the beginning */ + if(5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = SFILE; + + /* Write a few bytes at 2GB */ + if(HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) + goto quit; + if(5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = LFILE; + + /* Write a few bytes at 4GB */ + if(HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) + goto quit; + if(5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = XLFILE; + + /* If this supports sparse_file, write a few bytes at 32GB */ + if(!sparse_support) + goto quit; + if(HDlseek(fd, 32*GB, SEEK_SET) != 32*GB) + goto quit; + if(5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = HUGEFILE; quit: - if (HDclose(fd) < 0) + if(HDclose(fd) < 0) goto error; - if (HDremove("y.h5") < 0) + if(HDremove("y.h5") < 0) goto error; - return(fsize); + return fsize; error: - if (fd >= 0){ + if(fd >= 0){ HDclose(fd); HDremove("y.h5"); } - return (fsize); + return fsize; } @@ -301,11 +290,11 @@ enough_room(hid_t fapl) /* Get file name template */ HDassert(H5FD_FAMILY==H5Pget_driver(fapl)); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); /* Create files */ for (i=0; i=0; i++) { - HDsnprintf(name, sizeof name, filename, i); + HDsnprintf(name, sizeof(name), filename, i); if(HDclose(fd[i]) < 0) ret_value=0; HDremove(name); @@ -603,123 +592,138 @@ usage(void) , (hsize_t)FAMILY_SIZE); } - - -/* Flush stdout at the end of this test routine to ensure later output to */ -/* stderr will not come out before it.*/ -int testvfd(vfd_t vfd) +static int +test_sec2(hid_t fapl) { - hid_t fapl=-1; char filename[1024]; fsizes_t testsize; + testsize = supports_big(); + if(testsize == NOFILE) { + HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n"); + goto quit; + } + /* Test big file with the SEC2 driver */ + HDputs("Testing big file with the SEC2 Driver "); - switch(vfd){ - case FAMILY_VFD: - /* Test huge file with the family driver */ - HDputs("Testing big file with the Family Driver "); - if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) - goto error; + if(writer(filename, fapl, testsize, WRT_N)) + goto error; + if(reader(filename, fapl)) + goto error; - if (cflag){ - /* - * We shouldn't run this test if the file system doesn't support holes - * because we would generate multi-gigabyte files. - */ - HDputs("Checking if file system is adequate for this test..."); - if (sizeof(long long)<8 || 0==GB8LL) { - HDputs("Test skipped because sizeof(long long) is too small. This"); - HDputs("hardware apparently doesn't support 64-bit integer types."); - usage(); - goto quit; - } - if (!sparse_support) { - HDputs("Test skipped because file system does not support holes."); - usage(); - goto quit; - } - if (!enough_room(fapl)) { - HDputs("Test skipped because of quota (file size or num open files)."); - usage(); - goto quit; - } - } + HDputs("Test passed with the SEC2 Driver."); - /* Do the test with the Family Driver */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); +quit: + /* End with normal return code */ + /* Clean up the test file */ + if(h5_cleanup(FILENAME, fapl)) + HDremove(DNAME); + return 0; - if (writer(filename, fapl, HUGEFILE, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; +error: + HDputs("*** TEST FAILED ***"); + return 1; +} /* end test_sec2() */ - HDputs("Test passed with the Family Driver."); - break; +static int +test_stdio(hid_t fapl) +{ + char filename[1024]; + fsizes_t testsize; - case SEC2_VFD: - testsize = supports_big(SEC2_VFD); - if (testsize == NOFILE) { - HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n"); - goto quit; - } - /* Test big file with the SEC2 driver */ - HDputs("Testing big file with the SEC2 Driver "); + testsize = supports_big(); + if(testsize == NOFILE) { + HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n"); + goto quit; + } + HDputs("\nTesting big file with the STDIO Driver "); - if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; - if(H5Pset_fapl_sec2(fapl) < 0) - goto error; + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if(writer(filename, fapl, testsize, WRT_N)) + goto error; + if(reader(filename, fapl)) + goto error; + HDputs("Test passed with the STDIO Driver."); - if (writer(filename, fapl, testsize, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; + /* Flush stdout at the end of this test routine to ensure later + * output to stderr will not come out before it. + */ - HDputs("Test passed with the SEC2 Driver."); - break; +quit: + /* End with normal return code */ + /* Clean up the test file */ + if(h5_cleanup(FILENAME, fapl)) + HDremove(DNAME); + HDfflush(stdout); + return 0; + +error: + HDputs("*** TEST FAILED ***"); + HDfflush(stdout); + return 1; +} /* end test_stdio() */ - case STDIO_VFD: - testsize = supports_big(STDIO_VFD); - if (testsize == NOFILE) { - HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n"); +static int +test_family(hid_t fapl) +{ + char filename[1024]; + + /* Test huge file with the family driver */ + HDputs("Testing big file with the Family Driver "); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + if(H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) + goto error; + + if(cflag){ + /* + * We shouldn't run this test if the file system doesn't support holes + * because we would generate multi-gigabyte files. + */ + HDputs("Checking if file system is adequate for this test..."); + if(sizeof(long long) < 8 || 0 == GB8LL) { + HDputs("Test skipped because sizeof(long long) is too small. This"); + HDputs("hardware apparently doesn't support 64-bit integer types."); + usage(); goto quit; } - HDputs("\nTesting big file with the STDIO Driver "); - - if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; - if(H5Pset_fapl_stdio(fapl) < 0) - goto error; + if(!sparse_support) { + HDputs("Test skipped because file system does not support holes."); + usage(); + goto quit; + } + if(!enough_room(fapl)) { + HDputs("Test skipped because of quota (file size or num open files)."); + usage(); + goto quit; + } + } - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + /* Do the test with the Family Driver */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if (writer(filename, fapl, testsize, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; - HDputs("Test passed with the STDIO Driver."); - break; + if(writer(filename, fapl, HUGEFILE, WRT_N)) + goto error; + if(reader(filename, fapl)) + goto error; - default: - HDputs("Unsupprted VFD"); - usage(); - goto error;; - } /* end of switch (vfd) */ + HDputs("Test passed with the Family Driver."); quit: /* End with normal return code */ /* Clean up the test file */ - if (h5_cleanup(FILENAME, fapl)) HDremove(DNAME); - HDfflush(stdout); + if(h5_cleanup(FILENAME, fapl)) + HDremove(DNAME); return 0; - error: - if (fapl>=0) H5Pclose(fapl); HDputs("*** TEST FAILED ***"); - HDfflush(stdout); return 1; -} - +} /* end test_family() */ /*------------------------------------------------------------------------- @@ -749,6 +753,8 @@ int main (int ac, char **av) { unsigned long seed = 0; /* Random # seed */ + hid_t fapl = -1; + hid_t driver = -1; /* parameters setup */ @@ -779,11 +785,16 @@ main (int ac, char **av) } } + /* check VFD to see if this is one we test */ + if((fapl = h5_fileaccess()) < 0) + goto error; + if((driver = H5Pget_driver(fapl)) < 0) + goto error; + /* check sparse file support unless cflag is not set. */ - if (cflag) + if(cflag) sparse_support = is_sparse(); - /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK @@ -792,19 +803,30 @@ main (int ac, char **av) #endif /* QAK */ HDsrandom(seed); - /*=================================================*/ - if (testvfd(FAMILY_VFD) != 0) - goto error; - if (testvfd(SEC2_VFD) != 0) - goto error; - if (testvfd(STDIO_VFD) != 0) - goto error; + /* run VFD-specific test */ + if(H5FD_SEC2 == driver) { + if(test_sec2(fapl) != 0) + goto error; + } + else if(H5FD_STDIO == driver) { + if(test_stdio(fapl) != 0) + goto error; + } + else if(H5FD_FAMILY == driver) { + if(test_family(fapl) != 0) + goto error; + } + else + HDputs("This VFD is not supported"); /* End with normal exit code */ + /* fapls are cleaned up in the vfd test code */ return 0; error: HDputs("*** TEST FAILED ***"); + if(fapl > 0) + H5Pclose(fapl); return 1; } diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 433c488..b3d17dc 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -614,7 +614,7 @@ test_compound (char *filename, hid_t fapl) if ((s8_m_sid = H5Screate_simple (2, h_size, NULL)) < 0) goto error; /* Read the dataset */ - s8 = (s1_t *) calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t)); + s8 = (s1_t *) HDcalloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t)); assert (s8); if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) { goto error; @@ -641,7 +641,7 @@ test_compound (char *filename, hid_t fapl) } } - free (s8); + HDfree (s8); s8 = NULL; PASSED(); @@ -781,7 +781,7 @@ test_compound (char *filename, hid_t fapl) f_offset[1] = NY/3; h_size[0] = 2*NX/3 - f_offset[0]; h_size[1] = 2*NY/3 - f_offset[1]; - s11 = (s4_t *) malloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t)); + s11 = (s4_t *) HDmalloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t)); assert (s11); /* Initialize */ @@ -793,7 +793,7 @@ test_compound (char *filename, hid_t fapl) if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) { goto error; } - free (s11); + HDfree (s11); s11=NULL; /* Read the whole thing */ @@ -1380,12 +1380,12 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Allocate space and initialize data */ - orig = (unsigned char*)malloc(NX * NY * sizeof(stype1)); + orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1)); initialize_stype1(orig, (size_t)NX*NY); - rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype2)); + rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2)); - rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype3)); + rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype3)); initialize_stype3(rew_buf, (size_t)NX*NY); @@ -1515,9 +1515,9 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Fclose(file) < 0) FAIL_STACK_ERROR - free(orig); - free(rbuf); - free(rew_buf); + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); PASSED(); return 0; @@ -1585,12 +1585,12 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Allocate space and initialize data */ - orig = (unsigned char*)malloc(NX * NY * sizeof(stype2)); + orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2)); initialize_stype2(orig, (size_t)NX*NY); - rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype1)); + rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1)); - rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype4)); + rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype4)); initialize_stype4(rew_buf, (size_t)NX*NY); /* Create dataset creation property list */ @@ -1719,9 +1719,9 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Fclose(file) < 0) goto error; - free(orig); - free(rbuf); - free(rew_buf); + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); PASSED(); return 0; diff --git a/test/dsets.c b/test/dsets.c index 736c5da..245b993 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -565,7 +565,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) HDclose(f); - free (tconv_buf); + HDfree (tconv_buf); PASSED(); } /* end if */ else { @@ -1936,13 +1936,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Dclose (dataset) < 0) goto error; if(H5Sclose (sid) < 0) goto error; if(H5Pclose (dxpl) < 0) goto error; - free (tconv_buf); + HDfree (tconv_buf); return(0); error: if(tconv_buf) - free (tconv_buf); + HDfree (tconv_buf); return -1; } @@ -6621,7 +6621,7 @@ auxread_fdata(hid_t fid, const char *name) if(H5Dclose(dset_id) < 0) goto error; if(buf) - free(buf); + HDfree(buf); return 0; @@ -6633,7 +6633,7 @@ error: H5Tclose(ftype_id); H5Tclose(mtype_id); if(buf) - free(buf); + HDfree(buf); } H5E_END_TRY; return -1; } diff --git a/test/dt_arith.c b/test/dt_arith.c index 9f003a6..c3692d0 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -296,8 +296,8 @@ static int without_hardware_g = 0; HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ \ - tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \ - tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \ + tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ + tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ \ buf_p = BUF; \ saved_p = SAVED; \ @@ -325,8 +325,8 @@ static int without_hardware_g = 0; buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ - free(tmp1); \ - free(tmp2); \ + HDfree(tmp1); \ + HDfree(tmp2); \ } /* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity, @@ -348,7 +348,7 @@ static int without_hardware_g = 0; SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - value = (unsigned char*)calloc(SRC_SIZE, sizeof(unsigned char)); \ + value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \ \ buf_p = BUF; \ \ @@ -391,7 +391,7 @@ static int without_hardware_g = 0; } \ \ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - free(value); \ + HDfree(value); \ } void some_dummy_func(float x); @@ -751,8 +751,8 @@ static int test_particular_fp_integer(void) endian = H5Tget_order(H5T_NATIVE_DOUBLE); src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE); dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR); - buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); - saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); + buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); + saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); memcpy(buf1, &src_d, src_size1); memcpy(saved_buf1, &src_d, src_size1); @@ -801,8 +801,8 @@ static int test_particular_fp_integer(void) /* Test conversion from float (the value is INT_MAX) to int. */ src_size2 = H5Tget_size(H5T_NATIVE_FLOAT); dst_size2 = H5Tget_size(H5T_NATIVE_INT); - buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); - saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); + buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); + saved_buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); HDmemcpy(buf2, &src_f, src_size2); HDmemcpy(saved_buf2, &src_f, src_size2); @@ -852,13 +852,13 @@ static int test_particular_fp_integer(void) } if(buf1) - free(buf1); + HDfree(buf1); if(buf2) - free(buf2); + HDfree(buf2); if(saved_buf1) - free(saved_buf1); + HDfree(saved_buf1); if(saved_buf2) - free(saved_buf2); + HDfree(saved_buf2); PASSED(); return 0; @@ -869,13 +869,13 @@ error: H5Pclose(dxpl_id); } H5E_END_TRY; if(buf1) - free(buf1); + HDfree(buf1); if(buf2) - free(buf2); + HDfree(buf2); if(saved_buf1) - free(saved_buf1); + HDfree(saved_buf1); if(saved_buf2) - free(saved_buf2); + HDfree(saved_buf2); reset_hdf5(); /*print statistics*/ return MAX((int)fails_this_test, 1); @@ -1044,11 +1044,11 @@ test_derived_flt(void) */ src_size = H5Tget_size(H5T_NATIVE_INT); endian = H5Tget_order(H5T_NATIVE_INT); - buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size))); - saved_buf = (unsigned char*)malloc(nelmts * src_size); + buf = (unsigned char*)HDmalloc(nelmts * (MAX(src_size, size))); + saved_buf = (unsigned char*)HDmalloc(nelmts * src_size); HDmemset(buf, 0, nelmts * MAX(src_size, size)); HDmemset(saved_buf, 0, nelmts * src_size); - aligned = (int*)calloc((size_t)1, src_size); + aligned = (int*)HDcalloc((size_t)1, src_size); for(i = 0; i < nelmts * src_size; i++) buf[i] = saved_buf[i] = HDrand(); @@ -1105,9 +1105,9 @@ test_derived_flt(void) } fails_this_test = 0; - free(buf); - free(saved_buf); - free(aligned); + HDfree(buf); + HDfree(saved_buf); + HDfree(aligned); buf = NULL; saved_buf = NULL; aligned = NULL; @@ -1204,8 +1204,8 @@ test_derived_flt(void) src_size = H5Tget_size(tid2); dst_size = H5Tget_size(tid1); endian = H5Tget_order(tid2); - buf = (unsigned char*)malloc(nelmts*(MAX(src_size, dst_size))); - saved_buf = (unsigned char*)malloc(nelmts*src_size); + buf = (unsigned char*)HDmalloc(nelmts*(MAX(src_size, dst_size))); + saved_buf = (unsigned char*)HDmalloc(nelmts*src_size); HDmemset(buf, 0, nelmts*MAX(src_size, dst_size)); HDmemset(saved_buf, 0, nelmts*src_size); @@ -1268,8 +1268,8 @@ test_derived_flt(void) } } - if (buf) free(buf); - if (saved_buf) free(saved_buf); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); if(H5Tclose(tid1) < 0) { H5_FAILED(); @@ -1301,9 +1301,9 @@ test_derived_flt(void) return 0; error: - if (buf) free(buf); - if (saved_buf) free(saved_buf); - if (aligned) free(aligned); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); + if (aligned) HDfree(aligned); HDfflush(stdout); H5E_BEGIN_TRY { H5Tclose (tid1); @@ -1594,8 +1594,8 @@ test_derived_integer(void) goto error; } /* end if */ - free(buf); - free(saved_buf); + HDfree(buf); + HDfree(saved_buf); PASSED(); reset_hdf5(); /*print statistics*/ @@ -1603,8 +1603,8 @@ test_derived_integer(void) return 0; error: - if (buf) free(buf); - if (saved_buf) free(saved_buf); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); HDfflush(stdout); H5E_BEGIN_TRY { H5Tclose (tid1); @@ -2781,7 +2781,7 @@ my_isinf(int endian, unsigned char *val, size_t size, int retval = 0; size_t i; - bits = (unsigned char*)calloc((size_t)1, size); + bits = (unsigned char*)HDcalloc((size_t)1, size); #ifdef H5_VMS if(H5T_ORDER_VAX==endian) { @@ -2805,7 +2805,7 @@ my_isinf(int endian, unsigned char *val, size_t size, H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0) retval = 1; - free(bits); + HDfree(bits); return retval; } diff --git a/test/dtypes.c b/test/dtypes.c index de64713..5826097 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -697,9 +697,9 @@ test_compound_2(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -762,9 +762,9 @@ test_compound_2(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs , st, dt) PASSED(); @@ -818,9 +818,9 @@ test_compound_3(void) FAIL_STACK_ERROR /* Initialize */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -880,9 +880,9 @@ test_compound_3(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -940,9 +940,9 @@ test_compound_4(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -1006,9 +1006,9 @@ test_compound_4(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -1175,9 +1175,9 @@ test_compound_6(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->b = (i*8+1) & 0x7fff; @@ -1223,9 +1223,9 @@ test_compound_6(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -1790,7 +1790,7 @@ test_compound_9(void) } /* end if */ rdata.i1 = rdata.i2 = 0; - if(rdata.str) free(rdata.str); + if(rdata.str) HDfree(rdata.str); if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); @@ -1804,7 +1804,7 @@ test_compound_9(void) goto error; } /* end if */ - if(rdata.str) free(rdata.str); + if(rdata.str) HDfree(rdata.str); if(H5Dclose(dset_id) < 0) goto error; @@ -1983,10 +1983,10 @@ test_compound_10(void) goto error; } - free(t1); - free(t2); - free(wdata[i].str); - free(rdata[i].str); + HDfree(t1); + HDfree(t2); + HDfree(wdata[i].str); + HDfree(rdata[i].str); } /* end for */ if(H5Dclose(dset_id) < 0) @@ -4547,7 +4547,7 @@ test_conv_enum_2(void) H5Tenum_insert(dsttype, mname[i], &i); /* Source data */ - data = (int*)malloc(NTESTELEM*sizeof(int)); + data = (int*)HDmalloc(NTESTELEM*sizeof(int)); for (i=0; ia = i*3 + 1; @@ -3963,7 +3963,7 @@ test_sohm_external_dtype(void) ret = H5Fclose(file2); CHECK_I(ret, "H5Fclose"); - free(orig); + HDfree(orig); } diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 0efd02c..dec2eee 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -113,7 +113,7 @@ void tts_acreate(void) * with the dataset */ for(i = 0; i < NUM_THREADS; i++) { - attrib_data = malloc(sizeof(ttsafe_name_data_t)); + attrib_data = HDmalloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; @@ -170,7 +170,7 @@ void *tts_acreate_thread(void *client_data) H5P_DEFAULT, H5P_DEFAULT); /* Write data to the attribute */ - attribute_data = malloc(sizeof(int)); + attribute_data = HDmalloc(sizeof(int)); *attribute_data = attrib_data->current_index; H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); H5Aclose(attribute); diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 8264403..56f431e 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -145,7 +145,7 @@ void *tts_cancel_thread(void UNUSED *arg) assert(dataset >= 0); /* If thread is cancelled, make cleanup call */ - cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t)); + cleanup_structure = (cancel_cleanup_t*)HDmalloc(sizeof(cancel_cleanup_t)); cleanup_structure->dataset = dataset; cleanup_structure->datatype = datatype; cleanup_structure->dataspace = dataspace; @@ -156,7 +156,7 @@ void *tts_cancel_thread(void UNUSED *arg) ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); assert(ret>=0); - buffer = malloc(sizeof(int)); + buffer = HDmalloc(sizeof(int)); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); assert(ret>=0); ret=H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); diff --git a/test/tunicode.c b/test/tunicode.c index 0386352..7dfda16 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -605,7 +605,7 @@ void test_compound(hid_t fid, const char * string) readbuf = H5Tget_member_name(s1_tid, 0); ret = HDstrcmp(readbuf, string); VERIFY(ret, 0, "strcmp"); - free(readbuf); + HDfree(readbuf); /* Add the other fields to the datatype */ ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); @@ -718,7 +718,7 @@ void test_opaque(hid_t UNUSED fid, const char * string) read_buf = H5Tget_tag(type_id); ret = strcmp(read_buf, string); VERIFY(ret, 0, "H5Tget_tag"); - free(read_buf); + HDfree(read_buf); ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 73e7f09..5dac36f 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -553,7 +553,7 @@ coll_chunktest(const char* filename, /* allocate memory for data buffer */ - data_array1 = (int *)malloc(dims[0] * dims[1] * sizeof(int)); + data_array1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* set up dimensions of the slab this process accesses */ @@ -748,11 +748,11 @@ coll_chunktest(const char* filename, /* Use collective read to verify the correctness of collective write. */ /* allocate memory for data buffer */ - data_array1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); + data_array1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* allocate memory for data buffer */ - data_origin1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); + data_origin1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); acc_plist = create_faccess_plist(comm, info, facc_type, use_gpfs); @@ -813,8 +813,8 @@ coll_chunktest(const char* filename, H5Fclose(file); /* release data buffers */ - if (data_array1) free(data_array1); - if (data_origin1) free(data_origin1); + if (data_array1) HDfree(data_array1); + if (data_origin1) HDfree(data_origin1); } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 39ca686..3cb627f 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -255,8 +255,8 @@ dataset_writeInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ---------------------------------------- * CREATE AN HDF5 FILE WITH PARALLEL ACCESS @@ -365,7 +365,7 @@ MPI_Barrier(MPI_COMM_WORLD); H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* Example of using the parallel HDF5 library to read a dataset */ @@ -401,10 +401,10 @@ dataset_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type, use_gpfs); @@ -474,8 +474,8 @@ dataset_readInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } @@ -527,8 +527,8 @@ dataset_writeAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -862,7 +862,7 @@ dataset_writeAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* @@ -907,10 +907,10 @@ dataset_readAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -1090,8 +1090,8 @@ dataset_readAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } @@ -1149,8 +1149,8 @@ extend_writeInd(void) chunk_dims[1] = chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -1329,7 +1329,7 @@ extend_writeInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* @@ -1535,12 +1535,12 @@ extend_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -1663,9 +1663,9 @@ extend_readInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_array2) free(data_array2); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_array2) HDfree(data_array2); + if(data_origin1) HDfree(data_origin1); } /* @@ -1723,8 +1723,8 @@ extend_writeAll(void) chunk_dims[1] = chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -1928,7 +1928,7 @@ extend_writeAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* Example of using the parallel HDF5 library to read an extendible dataset */ @@ -1967,12 +1967,12 @@ extend_readAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -2119,9 +2119,9 @@ extend_readAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_array2) free(data_array2); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_array2) HDfree(data_array2); + if(data_origin1) HDfree(data_origin1); } /* @@ -2163,9 +2163,9 @@ compress_readAll(void) /* Allocate data buffer */ data_orig = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); - VRFY((data_orig != NULL), "data_origin1 malloc succeeded"); + VRFY((data_orig != NULL), "data_origin1 HDmalloc succeeded"); data_read = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); - VRFY((data_read != NULL), "data_array1 malloc succeeded"); + VRFY((data_read != NULL), "data_array1 HDmalloc succeeded"); /* Initialize data buffers */ for(u=0; u= 0), "H5D close succeeded"); /* release data buffers */ - if(write_buf) free(write_buf); - if(read_buf) free(read_buf); + if(write_buf) HDfree(write_buf); + if(read_buf) HDfree(read_buf); /* open dataset2 (non-contiguous case) */ dataset2 = H5Dopen2(fid, DATASETNAME6, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dopen2 succeeded"); /* allocate memory for data buffer */ - write_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((write_buf != NULL), "write_buf malloc succeeded"); + write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((read_buf != NULL), "read_buf malloc succeeded"); + read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); for (i=0 ; i= 0), "H5Sclose succeeded"); /* release data buffers */ - if(write_buf) free(write_buf); - if(read_buf) free(read_buf); + if(write_buf) HDfree(write_buf); + if(read_buf) HDfree(read_buf); ret = H5Fclose(fid); VRFY((ret >= 0), "H5Fclose succeeded"); diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index 8d6b5a3..5a711cd 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -186,8 +186,8 @@ filter_read_internal(const char *filename, hid_t dcpl, hrc = H5Fclose (file); VRFY(hrc>=0, "H5Fclose"); - free(points); - free(check); + HDfree(points); + HDfree(check); MPI_Barrier(MPI_COMM_WORLD); } diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index fa9cf9d..a74aa22 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -282,7 +282,7 @@ test_mpio_gb_file(char *filename) printf("Skipped GB file range test " "because MPI_Offset cannot support it\n"); }else{ - buf = malloc(MB); + buf = HDmalloc(MB); VRFY((buf!=NULL), "malloc succeed"); /* open a new file. Remove it first in case it exists. */ diff --git a/testpar/t_posix_compliant.c b/testpar/t_posix_compliant.c index 1bc0053..207f07e 100644 --- a/testpar/t_posix_compliant.c +++ b/testpar/t_posix_compliant.c @@ -105,8 +105,8 @@ static int allwrite_allread_blocks(int numprocs, int rank, int write_size) int amode, i; MPI_Offset offset = rank*write_size*sizeof(int); MPI_Status Status; - int* writebuf = (int*)malloc(write_size*sizeof(int)); - int* readbuf = (int*)malloc (write_size*sizeof(int)); + int* writebuf = (int*)HDmalloc(write_size*sizeof(int)); + int* readbuf = (int*)HDmalloc (write_size*sizeof(int)); for(i=0; ip = malloc( 1 * sizeof(int) ); + tvl->p = HDmalloc( 1 * sizeof(int) ); tvl->len = 1; ((int *)tvl->p)[0]=1; buf[1].len = 1; - buf[1].p = malloc( 1 * sizeof(hvl_t)); + buf[1].p = HDmalloc( 1 * sizeof(hvl_t)); tvl = (hvl_t *)buf[1].p; - tvl->p = malloc( 2 * sizeof(int) ); + tvl->p = HDmalloc( 2 * sizeof(int) ); tvl->len = 2; ((int *)tvl->p)[0]=2; ((int *)tvl->p)[1]=3; diff --git a/tools/h5copy/testh5copy.sh.in b/tools/h5copy/testh5copy.sh.in index bec3bfc..77c64c4 100644 --- a/tools/h5copy/testh5copy.sh.in +++ b/tools/h5copy/testh5copy.sh.in @@ -67,6 +67,8 @@ H5DIFF_BIN=`pwd`/../h5diff/$H5DIFF # The path of the h5diff tool binary H5LS=h5ls # The h5ls tool name H5LS_ARGS=-Svr # Arguments to the h5ls tool H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary + +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -121,6 +123,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a "SKIP" message SKIP() { @@ -578,6 +593,8 @@ COPY_REFERENCES COPY_EXT_LINKS TEST_MISC +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index cf46e74..59cab0d 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -174,7 +174,7 @@ void parse_command_line(int argc, options->exclude_path = 1; /* create linked list of excluding objects */ - if( (exclude_node = (struct exclude_path_list*) malloc(sizeof(struct exclude_path_list))) == NULL) + if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) { printf("Error: lack of memory!\n"); h5diff_exit(EXIT_FAILURE); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 517f496..a31f423 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -4576,7 +4576,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a for(i=0; i= 0); + + /* Create the array data type for the 16 bits signed int array */ + array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F76_ARRAY_RANK, array_dim16); + HDassert(array16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F76_ARRAY_RANK, array_dim32); + HDassert(array32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F76_ARRAY_RANK, array_dim64); + HDassert(array64_tid >= 0); + + /* Create the array data type for the 8 bits signed int array */ + arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F76_ARRAY_RANK, array_dim8); + HDassert(arrayu8_tid >= 0); + + /* Create the array data type for the 16 bits signed int array */ + arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F76_ARRAY_RANK, array_dim16); + HDassert(arrayu16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F76_ARRAY_RANK, array_dim32); + HDassert(arrayu32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F76_ARRAY_RANK, array_dim64); + HDassert(arrayu64_tid >= 0); + + /* Create the array data type for the 32 bits double array */ + arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F76_ARRAY_RANK, array_dim8); + HDassert(arraydbl_tid >= 0); + + /* Create the dataspace */ + space = H5Screate_simple(F76_RANK, dim, NULL); + HDassert(space >= 0); + + /* Create the file */ + fid = H5Fcreate(FILE76, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid >= 0); + + /* Create the memory data type */ + Cmpd1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd1Struct)); + HDassert(Cmpd1Structid >= 0); + + /* Insert the arrays and variables into the structure */ + status = H5Tinsert(Cmpd1Structid, F76_DATASETU08, HOFFSET(Cmpd1Struct, dsetu8), arrayu8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU16, HOFFSET(Cmpd1Struct, dsetu16), arrayu16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU32, HOFFSET(Cmpd1Struct, dsetu32), arrayu32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU64, HOFFSET(Cmpd1Struct, dsetu64), arrayu64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS08, HOFFSET(Cmpd1Struct, dset8), array8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS16, HOFFSET(Cmpd1Struct, dset16), array16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS32, HOFFSET(Cmpd1Struct, dset32), array32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS64, HOFFSET(Cmpd1Struct, dset64), array64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DUMMYDBL, HOFFSET(Cmpd1Struct, dsetdbl), arraydbl_tid); + HDassert(status >= 0); + + /* Create the dataset */ + dataset = H5Dcreate2(fid, F76_DATASETNAME, Cmpd1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Write data to the dataset */ + status = H5Dwrite(dataset, Cmpd1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd1); + HDassert(status >= 0); + + /* Release resources */ + status = H5Tclose(Cmpd1Structid); + HDassert(status >= 0); + + status = H5Tclose(arrayu8_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu16_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu32_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu64_tid); + HDassert(status >= 0); + + status = H5Tclose(array8_tid); + HDassert(status >= 0); + + status = H5Tclose(array16_tid); + HDassert(status >= 0); + + status = H5Tclose(array32_tid); + HDassert(status >= 0); + + status = H5Tclose(array64_tid); + HDassert(status >= 0); + + status = H5Tclose(arraydbl_tid); + HDassert(status >= 0); + + status = H5Sclose(space); + HDassert(status >= 0); + + status = H5Dclose(dataset); + HDassert(status >= 0); + + status = H5Fclose(fid); + HDassert(status >= 0); +} + +static void gent_compound_ints(void) { + hid_t fid, dataset, space; + hsize_t dims[1]; + uint8_t valu8bits = (uint8_t) ~0u; /* all 1s */ + uint16_t valu16bits = (uint16_t) ~0u; /* all 1s */ + uint32_t valu32bits = (uint32_t) ~0u; /* all 1s */ + uint64_t valu64bits = (uint64_t) ~0Lu; /* all 1s */ + int8_t val8bits = (int8_t) ~0; /* all 1s */ + int16_t val16bits = (int16_t) ~0; /* all 1s */ + int32_t val32bits = (int32_t) ~0; /* all 1s */ + int64_t val64bits = (int64_t) ~0L; /* all 1s */ + /* Structure and array for compound types */ + typedef struct Cmpd1Struct { + uint8_t dsetu8; + uint16_t dsetu16; + uint32_t dsetu32; + uint64_t dsetu64; + int8_t dset8; + int16_t dset16; + int32_t dset32; + int64_t dset64; + double dsetdbl; + } Cmpd1Struct; + Cmpd1Struct Cmpd1[F77_LENGTH]; + + typedef struct Cmpd2Struct { + uint64_t dsetu64; + uint32_t dsetu32; + uint16_t dsetu16; + uint8_t dsetu8; + int64_t dset64; + int32_t dset32; + int16_t dset16; + int8_t dset8; + double dsetdbl; + } Cmpd2Struct; + Cmpd2Struct Cmpd2[F77_LENGTH]; + + hid_t Cmpd1Structid; /* File datatype identifier */ + hid_t Cmpd2Structid; /* File datatype identifier */ + herr_t status; /* Error checking variable */ + hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */ + + int m; /* Array init loop vars */ + + /* Initialize the data in the arrays/datastructure */ + for (m = 0; m < F77_LENGTH; m++) { + + /* Array of 8 bits unsigned int */ + if((m % F76_DIM8) == 0) + valu8bits = (uint8_t) ~0u; /* all 1s */ + Cmpd1[m].dsetu8 = valu8bits; + Cmpd2[m].dsetu8 = valu8bits; + valu8bits <<= 1; + + /* Array of 16 bits unsigned int */ + if((m % F76_DIM16) == 0) + valu16bits = (uint16_t) ~0u; /* all 1s */ + Cmpd1[m].dsetu16 = valu16bits; + Cmpd2[m].dsetu16 = valu16bits; + valu16bits <<= 1; + + /* Array of 32 bits unsigned int */ + if((m % F76_DIM32) == 0) + valu32bits = (uint32_t) ~0u; /* all 1s */ + Cmpd1[m].dsetu32 = valu32bits; + Cmpd2[m].dsetu32 = valu32bits; + valu32bits <<= 1; + + /* Array of 64 bits unsigned int */ + if((m % F76_DIM64) == 0) + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + Cmpd1[m].dsetu64 = valu64bits; + Cmpd2[m].dsetu64 = valu64bits; + valu64bits <<= 1; + + /* Array of 8 bits signed int */ + if((m % F76_DIM8) == 0) + val8bits = (int8_t) ~0; /* all 1s */ + Cmpd1[m].dset8 = val8bits; + Cmpd2[m].dset8 = val8bits; + val8bits <<= 1; + + /* Array of 16 bits signed int */ + if((m % F76_DIM16) == 0) + val16bits = (int16_t) ~0; /* all 1s */ + Cmpd1[m].dset16 = val16bits; + Cmpd2[m].dset16 = val16bits; + val16bits <<= 1; + + /* Array of 32 bits signed int */ + if((m % F76_DIM32) == 0) + val32bits = (int32_t) ~0; /* all 1s */ + Cmpd1[m].dset32 = val32bits; + Cmpd2[m].dset32 = val32bits; + val32bits <<= 1; + + /* Array of 64 bits signed int */ + if((m % F76_DIM64) == 0) + val64bits = (int64_t) ~0L; /* all 1s */ + Cmpd1[m].dset64 = val64bits; + Cmpd2[m].dset64 = val64bits; + val64bits <<= 1; + + /* Double Dummy set for failure tests */ + Cmpd1[m].dsetdbl = 0.0001 + m; + Cmpd2[m].dsetdbl = 0.0001 + m; + } + + /* Create the dataspace */ + space = H5Screate_simple(F76_RANK, dim, NULL); + HDassert(space >= 0); + + /* Create the file */ + fid = H5Fcreate(FILE77, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid >= 0); + + /* Create the memory data type */ + Cmpd1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd1Struct)); + HDassert(Cmpd1Structid >= 0); + + /* Insert the arrays and variables into the structure */ + status = H5Tinsert(Cmpd1Structid, F76_DATASETU08, HOFFSET(Cmpd1Struct, dsetu8), H5T_NATIVE_UCHAR); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU16, HOFFSET(Cmpd1Struct, dsetu16), H5T_NATIVE_USHORT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU32, HOFFSET(Cmpd1Struct, dsetu32), H5T_NATIVE_UINT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETU64, HOFFSET(Cmpd1Struct, dsetu64), H5T_NATIVE_ULONG); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS08, HOFFSET(Cmpd1Struct, dset8), H5T_NATIVE_SCHAR); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS16, HOFFSET(Cmpd1Struct, dset16), H5T_NATIVE_SHORT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS32, HOFFSET(Cmpd1Struct, dset32), H5T_NATIVE_INT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DATASETS64, HOFFSET(Cmpd1Struct, dset64), H5T_NATIVE_LONG); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd1Structid, F76_DUMMYDBL, HOFFSET(Cmpd1Struct, dsetdbl), H5T_NATIVE_DOUBLE); + HDassert(status >= 0); + + /* Create the dataset */ + dataset = H5Dcreate2(fid, F77_DATASETNAME1, Cmpd1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Write data to the dataset */ + status = H5Dwrite(dataset, Cmpd1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd1); + HDassert(status >= 0); + + /* Release resources */ + status = H5Tclose(Cmpd1Structid); + HDassert(status >= 0); + + status = H5Sclose(space); + HDassert(status >= 0); + + status = H5Dclose(dataset); + HDassert(status >= 0); + + /* Create the dataspace */ + space = H5Screate_simple(F76_RANK, dim, NULL); + HDassert(space >= 0); + + /* Create the memory data type */ + Cmpd2Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd2Struct)); + HDassert(Cmpd2Structid >= 0); + + /* Insert the arrays and variables into the structure */ + status = H5Tinsert(Cmpd2Structid, F76_DATASETU64, HOFFSET(Cmpd2Struct, dsetu64), H5T_NATIVE_ULONG); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETU32, HOFFSET(Cmpd2Struct, dsetu32), H5T_NATIVE_UINT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETU16, HOFFSET(Cmpd2Struct, dsetu16), H5T_NATIVE_USHORT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETU08, HOFFSET(Cmpd2Struct, dsetu8), H5T_NATIVE_UCHAR); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETS64, HOFFSET(Cmpd2Struct, dset64), H5T_NATIVE_LONG); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETS32, HOFFSET(Cmpd2Struct, dset32), H5T_NATIVE_INT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETS16, HOFFSET(Cmpd2Struct, dset16), H5T_NATIVE_SHORT); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DATASETS08, HOFFSET(Cmpd2Struct, dset8), H5T_NATIVE_SCHAR); + HDassert(status >= 0); + + status = H5Tinsert(Cmpd2Structid, F76_DUMMYDBL, HOFFSET(Cmpd2Struct, dsetdbl), H5T_NATIVE_DOUBLE); + HDassert(status >= 0); + + /* Create the dataset */ + dataset = H5Dcreate2(fid, F77_DATASETNAME2, Cmpd2Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Write data to the dataset */ + status = H5Dwrite(dataset, Cmpd2Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd2); + HDassert(status >= 0); + + /* Release resources */ + status = H5Tclose(Cmpd2Structid); + HDassert(status >= 0); + + status = H5Sclose(space); + HDassert(status >= 0); + + status = H5Dclose(dataset); + HDassert(status >= 0); + + status = H5Fclose(fid); + HDassert(status >= 0); +} + /*------------------------------------------------------------------------- * Function: main * @@ -8751,6 +9250,8 @@ int main(void) gent_intscalars(); gent_attr_intscalars(); gent_string_scalars(); + gent_compound_int_array(); + gent_compound_ints(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 1a0f189..dc52469 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -30,7 +30,7 @@ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary - +RM='rm -rf' CMP='cmp' DIFF='diff -c' CP='cp' @@ -396,6 +396,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -1258,6 +1271,8 @@ TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in index def687b..0f6503d 100644 --- a/tools/h5dump/testh5dumppbits.sh.in +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -38,7 +38,7 @@ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary - +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -189,6 +189,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -576,6 +589,8 @@ TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 # Incomplete pair of packed bits request. TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 6e4efd1..4dad9cd 100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -26,6 +26,7 @@ H5_LONE_COLON="@H5_LONE_COLON@" DUMPER=h5dump # The tool name DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -217,6 +218,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -372,6 +386,8 @@ TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=desce # tests for floating point user defined printf format TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5 +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index cb76204..96cca87 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -105,7 +105,7 @@ IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) ENDIF (NOT "${last_test}" STREQUAL "") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( @@ -118,6 +118,7 @@ ${testfile}.out ${testfile}.out.err ) + SET_TESTS_PROPERTIES (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) ADD_TEST (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) @@ -167,6 +168,7 @@ d${testfile}.dff d${testfile}.dff.err ) + SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) IF ("${ARGN}" STREQUAL "BINARY") ADD_TEST ( @@ -407,10 +409,25 @@ SET (last_test "H5IMPORT-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5IMPORT-h5importtest COMMAND $) + ADD_TEST ( + NAME H5IMPORT-h5importtest-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + binfp64.bin + binin8.bin + binin8w.bin + binin16.bin + binin32.bin + binuin16.bin + binuin32.bin + ) IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-h5importtest PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5IMPORT-clear-objects") + + ADD_TEST (NAME H5IMPORT-h5importtest COMMAND $) + SET_TESTS_PROPERTIES (H5IMPORT-h5importtest PROPERTIES DEPENDS H5IMPORT-h5importtest-clear-objects) # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) diff --git a/tools/h5import/Makefile.am b/tools/h5import/Makefile.am index 167dbc9..6d18e25 100644 --- a/tools/h5import/Makefile.am +++ b/tools/h5import/Makefile.am @@ -40,4 +40,7 @@ h5import_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All programs depend on the main hdf5 library and the tools library LDADD=$(LIBH5TOOLS) $(LIBHDF5) +# Temporary files from h5importtest +CHECK_CLEANFILES+=*.bin + include $(top_srcdir)/config/conclude.am diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index bfb777a..94910af 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -428,7 +428,9 @@ TRACE = perl $(top_srcdir)/bin/trace # .chkexe files are used to mark tests that have run successfully. # .chklog files are output from those tests. # *.clog are from the MPE option. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog + +# Temporary files from h5importtest +CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.bin # Include src and tools/lib directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib diff --git a/tools/h5import/h5importtestutil.sh.in b/tools/h5import/h5importtestutil.sh.in index fd21dc1..e50ddac 100644 --- a/tools/h5import/h5importtestutil.sh.in +++ b/tools/h5import/h5importtestutil.sh.in @@ -25,6 +25,7 @@ TESTNAME=h5import EXIT_SUCCESS=0 EXIT_FAILURE=1 +RM='rm -rf' CP='cp' DIRNAME='dirname' LS='ls' @@ -147,6 +148,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + TESTING() { SPACES=" " echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' @@ -350,6 +364,9 @@ else nerrors="` expr $nerrors + 1 `"; fi +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR + # # Check errors result if test $nerrors -eq 0 ; then diff --git a/tools/h5jam/Makefile.am b/tools/h5jam/Makefile.am index c6ccebf..62a5ba7 100644 --- a/tools/h5jam/Makefile.am +++ b/tools/h5jam/Makefile.am @@ -39,7 +39,7 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5) # Temporary files. *.h5 are generated by jamgentest. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 +CHECK_CLEANFILES+=*.h5 testfiles/h5jam-*-sav testfiles/h5unjam-*-sav DISTCLEANFILES=testh5jam.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 7256d6e..c16c300 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -445,7 +445,8 @@ TRACE = perl $(top_srcdir)/bin/trace # Temporary files. *.h5 are generated by jamgentest. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 +CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 testfiles/h5jam-*-sav \ + testfiles/h5unjam-*-sav # Include src and tools/lib directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index d84f7f2..3aff2b4 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -165,7 +165,7 @@ main (int argc, const char *argv[]) if (res < (long)size) { if (buf) - free (buf); + HDfree (buf); HDclose (fd); exit (EXIT_FAILURE); } @@ -173,7 +173,7 @@ main (int argc, const char *argv[]) HDwrite (1, buf, (unsigned)size); if (buf) - free (buf); + HDfree (buf); HDclose (fd); return (EXIT_SUCCESS); } diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index 86edbee..36f0657 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -34,6 +34,7 @@ UNJAM=h5unjam # Tool to test JAM_BIN="$RUNSERIAL "`pwd` # The path of the jam binary UNJAM_BIN=`pwd` # The path of the jam binary +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' AWK='awk' @@ -122,6 +123,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -497,10 +511,10 @@ TOOLTEST_OUTPUT() { # Create the expect file if it doesn't yet exist. echo " CREATED" cp $actual $expect - rm -f $actual $actual_err + rm -f $actual $actual_sav $actual_err $actual_err_sav elif $CMP $expect $actual; then echo " PASSED" - rm -f $actual $actual_err + rm -f $actual $actual_sav $actual_err $actual_err_sav else echo "*FAILED*" echo " Expected result differs from actual result" @@ -675,7 +689,8 @@ UNJAMTEST taj3.h5 --delete tac3.h5 CHECKFILE $TESTDIR/tall.h5 tac3.h5 CLEANUP tac3.h5 taj3.h5 - +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 1e3acc8..68b317c 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -24,6 +24,7 @@ EXIT_FAILURE=1 H5LS=h5ls # The tool name H5LS_BIN=`pwd`/$H5LS # The path of the tool binary +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -191,6 +192,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". TESTING() { @@ -409,6 +423,8 @@ fi # test for file with datasets that use Fixed Array chunk indices echo "***skip testing tdset_idx.h5" #TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5 +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index 663e501..eae296d 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -72,7 +72,7 @@ endif # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 *.bin +CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 DISTCLEANFILES=h5repack.sh h5repack_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index fc37649..9f0e6f1 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -481,7 +481,8 @@ TRACE = perl $(top_srcdir)/bin/trace # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.bin +CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.bin \ + testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 # Include src, test, and tools/lib directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 583b6ef..045aebf 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -42,6 +42,7 @@ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary H5DUMP=../h5dump/h5dump # The h5dump tool name H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary +RM='rm -rf' GREP='grep' CP='cp' DIRNAME='dirname' @@ -161,6 +162,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a $* message left justified in a field of 70 characters # MESSAGE() { @@ -1088,6 +1102,9 @@ TOOLTEST HDFFV-7840 h5diff_attr1.h5 TOOLTEST_META meta_short h5repack_layout.h5 -M 8192 TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR + if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." exit $EXIT_SUCCESS diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index a45d1fe..df4b374 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -35,7 +35,7 @@ TEST_NAME=ud_plugin FROM_DIR=`pwd`/.libs PLUGIN_LIB="$FROM_DIR/libdynlibadd.*" PLUGIN_LIBDIR=testdir3 -RM="rm -rf" +RM='rm -rf' GREP='grep' CP='cp' @@ -118,6 +118,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a $* message left justified in a field of 70 characters # MESSAGE() { @@ -233,6 +246,10 @@ else exit_code=$EXIT_SUCCESS fi +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR + # Clean up temporary files/directories and leave $RM $PLUGIN_LIBDIR + exit $exit_code diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index cc4e063..4b6a00b 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -3382,7 +3382,7 @@ int make_big(hid_t loc_id) goto out; /* initialize buffer to 0 */ - buf=(signed char *) calloc( nelmts, size); + buf=(signed char *) HDcalloc( nelmts, size); if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) goto out; @@ -3863,10 +3863,10 @@ int write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -3925,7 +3925,7 @@ int write_dset_in(hid_t loc_id, /* allocate and initialize array data to write */ size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = (double*)malloc( size ); + dbuf = (double*)HDmalloc( size ); if (NULL == dbuf) { printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); @@ -4099,7 +4099,7 @@ int write_dset_in(hid_t loc_id, { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { @@ -4320,7 +4320,7 @@ int write_dset_in(hid_t loc_id, { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { @@ -4450,8 +4450,8 @@ int make_dset_reg_ref(hid_t loc_id) int retval = -1; /* return value */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - dwbuf = (int *)malloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); /* Create dataspace for datasets */ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) @@ -4791,10 +4791,10 @@ int write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc(2 * sizeof(int)); + buf5[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -5111,7 +5111,7 @@ int write_attr_in(hid_t loc_id, for (j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs)((int *)buf52[i][j].p)[l] = 0; @@ -5577,7 +5577,7 @@ int write_attr_in(hid_t loc_id, for (k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)i + 1; for (l = 0; l < i + 1; l++) if (make_diffs) @@ -6803,11 +6803,11 @@ static herr_t make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_objref_data[0].len = LEN0_VLEN_OBJREF; - vlen_objref_data[0].p = malloc (vlen_objref_data[0].len * sizeof(hobj_ref_t)); + vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t)); vlen_objref_data[1].len = LEN1_VLEN_OBJREF; - vlen_objref_data[1].p = malloc (vlen_objref_data[1].len * sizeof(hobj_ref_t)); + vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t)); vlen_objref_data[2].len = LEN2_VLEN_OBJREF; - vlen_objref_data[2].p = malloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); + vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); /* * create obj references @@ -6872,7 +6872,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_regref_data[0].len = LEN0_VLEN_REGREF; - vlen_regref_data[0].p = malloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); + vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); /* * create region reference diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index a5d7eef..e9fa0fa 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -823,7 +823,7 @@ freespace_stats(hid_t fid, iter_t *iter) } /* end for */ if(sect_info) - free(sect_info); + HDfree(sect_info); return 0; } /* end freespace_stats() */ @@ -1756,9 +1756,9 @@ main(int argc, const char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ - iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index 91b9c3d..85cc1d4 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -37,6 +37,7 @@ EXIT_FAILURE=1 STAT=h5stat # The tool name STAT_BIN=`pwd`/$STAT # The path of the tool binary +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -149,6 +150,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -298,6 +312,9 @@ TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5 TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5 # +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR + if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." exit $EXIT_SUCCESS diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 07f6bfd..ffd52e8 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -290,7 +290,7 @@ main (int argc, char *argv[]) if (argno