From 35f0e16e34e5f7691a39693ee4da4e67b1bed69b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Jan 2017 14:05:25 -0600 Subject: HDFFV-9994 port changes from develop. CMake folder changes brought up to standard. --- MANIFEST | 7 + config/cmake_ext_mod/CheckTypeSize.cmake | 22 +-- config/cmake_ext_mod/ConfigureChecks.cmake | 208 ++++++++++---------- config/cmake_ext_mod/FindSZIP.cmake | 42 ++-- config/cmake_ext_mod/HDFCXXTests.cpp | 35 ++++ config/cmake_ext_mod/HDFLibMacros.cmake | 34 ++-- config/cmake_ext_mod/HDFMacros.cmake | 106 +++++----- config/cmake_ext_mod/HDFTests.c | 49 +---- config/cmake_ext_mod/HDFUseFortran.cmake | 21 +- config/cmake_ext_mod/grepTest.cmake | 20 +- config/cmake_ext_mod/prunTest.cmake | 145 -------------- config/cmake_ext_mod/runTest.cmake | 34 ++-- configure | 7 +- configure.ac | 5 +- tools/h5diff/CMakeLists.txt | 32 ++- tools/h5diff/CMakeTests.cmake | 122 +++++++----- tools/h5diff/Makefile.am | 16 ++ tools/h5diff/Makefile.in | 177 +++++++++++------ tools/h5diff/dynlib_diff.c | 94 +++++++++ tools/h5diff/h5diff_plugin.sh.in | 299 +++++++++++++++++++++++++++++ tools/h5diff/testfiles/h5diff_ud.txt | 11 ++ tools/h5diff/testfiles/h5diff_udfail.txt | 12 ++ tools/h5diff/testfiles/tudfilter.h5 | Bin 0 -> 4816 bytes tools/h5diff/testfiles/tudfilter2.h5 | Bin 0 -> 4816 bytes tools/h5diff/testh5diff.sh.in | 170 ++++++++-------- tools/h5dump/CMakeLists.txt | 33 +++- tools/h5dump/CMakeTests.cmake | 188 +++++++++--------- tools/h5dump/CMakeTestsPBITS.cmake | 21 +- tools/h5dump/CMakeTestsXML.cmake | 29 ++- tools/h5dump/Makefile.am | 14 ++ tools/h5dump/Makefile.in | 176 +++++++++++------ tools/h5dump/dynlib_dump.c | 94 +++++++++ tools/h5dump/h5dump_plugin.sh.in | 226 ++++++++++++++++++++++ tools/h5dump/h5dumpgentest.c | 191 +++++++++++++++--- tools/h5dump/testh5dump.sh.in | 56 +++--- tools/h5dump/testh5dumppbits.sh.in | 2 +- tools/h5dump/testh5dumpxml.sh.in | 2 +- tools/h5ls/CMakeLists.txt | 30 ++- tools/h5ls/CMakeTests.cmake | 63 +++++- tools/h5ls/Makefile.am | 16 ++ tools/h5ls/Makefile.in | 186 ++++++++++++------ tools/h5ls/dynlib_ls.c | 94 +++++++++ tools/h5ls/h5ls_plugin.sh.in | 238 +++++++++++++++++++++++ tools/h5ls/testh5ls.sh.in | 55 +++--- tools/lib/h5diff.c | 12 +- tools/lib/h5diff_dset.c | 54 +++--- tools/lib/h5tools_dump.c | 4 +- tools/lib/h5tools_str.c | 2 +- tools/testfiles/tudfilter.ddl | 30 +++ tools/testfiles/tudfilter.h5 | Bin 0 -> 4816 bytes tools/testfiles/tudfilter.ls | 23 +++ 51 files changed, 2519 insertions(+), 988 deletions(-) delete mode 100644 config/cmake_ext_mod/prunTest.cmake create mode 100644 tools/h5diff/dynlib_diff.c create mode 100644 tools/h5diff/h5diff_plugin.sh.in create mode 100644 tools/h5diff/testfiles/h5diff_ud.txt create mode 100644 tools/h5diff/testfiles/h5diff_udfail.txt create mode 100644 tools/h5diff/testfiles/tudfilter.h5 create mode 100644 tools/h5diff/testfiles/tudfilter2.h5 create mode 100644 tools/h5dump/dynlib_dump.c create mode 100644 tools/h5dump/h5dump_plugin.sh.in create mode 100644 tools/h5ls/dynlib_ls.c create mode 100644 tools/h5ls/h5ls_plugin.sh.in create mode 100644 tools/testfiles/tudfilter.ddl create mode 100644 tools/testfiles/tudfilter.h5 create mode 100644 tools/testfiles/tudfilter.ls diff --git a/MANIFEST b/MANIFEST index f462b1d..a4775ff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1485,6 +1485,9 @@ ./tools/testfiles/tstring2.ddl ./tools/testfiles/tstringe.ddl ./tools/testfiles/tszip.ddl +./tools/testfiles/tudfilter.ddl +./tools/testfiles/tudfilter.h5 +./tools/testfiles/tudfilter.ls ./tools/testfiles/tudlink.h5 ./tools/testfiles/tudlink.h5.xml ./tools/testfiles/tudlink-1.ddl @@ -1996,6 +1999,10 @@ ./tools/h5diff/testfiles/tmptest.he5 ./tools/h5diff/testfiles/h5diff_tmp2.txt ./tools/h5diff/testfiles/tmpSingleSiteBethe.output.h5 +./tools/h5diff/testfiles/tudfilter.h5 +./tools/h5diff/testfiles/tudfilter2.h5 +./tools/h5diff/testfiles/h5diff_ud.txt +./tools/h5diff/testfiles/h5diff_udfail.txt #test files for h5repack ./tools/h5repack/testfiles/README diff --git a/config/cmake_ext_mod/CheckTypeSize.cmake b/config/cmake_ext_mod/CheckTypeSize.cmake index 5095a27..85b1c6c 100644 --- a/config/cmake_ext_mod/CheckTypeSize.cmake +++ b/config/cmake_ext_mod/CheckTypeSize.cmake @@ -10,21 +10,21 @@ MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - set (MACRO_CHECK_TYPE_SIZE_FLAGS + set (MACRO_CHECK_TYPE_SIZE_FLAGS "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}" ) foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H) if ("${def}") set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") - endif ("${def}") - endforeach (def) + endif () + endforeach () message (STATUS "Check size of ${TYPE}") if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_TYPE_SIZE_ADD_LIBRARIES + set (CHECK_TYPE_SIZE_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" ) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () try_run (${VARIABLE} HAVE_${VARIABLE} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/CheckTypeSize.c @@ -35,16 +35,16 @@ MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) if (HAVE_${VARIABLE}) message (STATUS "Check size of ${TYPE} - done") file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log + ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n" ) - else (HAVE_${VARIABLE}) + else () message (STATUS "Check size of ${TYPE} - failed") file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n" ) - endif (HAVE_${VARIABLE}) - endif ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + endif () + endif () set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS) -ENDMACRO (HDF_CHECK_TYPE_SIZE) +ENDMACRO () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 9589295..1872cd5 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -11,9 +11,9 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) -if(CMAKE_CXX_COMPILER) +if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) -endif(CMAKE_CXX_COMPILER) +endif () #----------------------------------------------------------------------------- # APPLE/Darwin setup @@ -28,17 +28,17 @@ if (APPLE) "variable has been set to a blank value which will build the default architecture for this system.") endif () set (${HDF_PREFIX}_AC_APPLE_UNIVERSAL_BUILD 0) -endif (APPLE) +endif () # Check for Darwin (not just Apple - we also want to catch OpenDarwin) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (${HDF_PREFIX}_HAVE_DARWIN 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +endif () # Check for Solaris if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set (${HDF_PREFIX}_HAVE_SOLARIS 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") +endif () #----------------------------------------------------------------------------- # This MACRO checks IF the symbol exists in the library and IF it @@ -49,8 +49,8 @@ MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) if (${VARIABLE}) set (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) - endif (${VARIABLE}) -ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) + endif () +ENDMACRO () # ---------------------------------------------------------------------- # WINDOWS Hard code Values @@ -62,7 +62,7 @@ if (WIN32) set (${HDF_PREFIX}_HAVE_MINGW 1) set (WINDOWS 1) # MinGW tries to imitate Windows set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - endif (MINGW) + endif () set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") if (NOT UNIX AND NOT MINGW) @@ -70,9 +70,9 @@ if (WIN32) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) - endif (MSVC) - endif (NOT UNIX AND NOT MINGW) -endif (WIN32) + endif () + endif () +endif () if (WINDOWS) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) @@ -84,20 +84,20 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) - endif (NOT MINGW) + endif () if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) - endif (NOT UNIX AND NOT CYGWIN AND NOT MINGW) + endif () set (${HDF_PREFIX}_HAVE_FUNCTION 1) set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) if (MINGW) set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) - endif (MINGW) + endif () set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) -endif (WINDOWS) +endif () # ---------------------------------------------------------------------- # END of WINDOWS Hard code Values @@ -105,7 +105,7 @@ endif (WINDOWS) if (CYGWIN) set (${HDF_PREFIX}_HAVE_LSEEK64 0) -endif (CYGWIN) +endif () #----------------------------------------------------------------------------- # Check for the math library "m" @@ -115,7 +115,7 @@ if (NOT WINDOWS) CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32) -endif (NOT WINDOWS) +endif () # UCB (BSD) compatibility library CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) @@ -126,11 +126,11 @@ set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) set (USE_INCLUDES "") if (WINDOWS) set (USE_INCLUDES ${USE_INCLUDES} "windows.h") -endif (WINDOWS) +endif () if (NOT WINDOWS) TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) -endif (NOT WINDOWS) +endif () # For other specific tests, use this MACRO. MACRO (HDF_FUNCTION_TEST OTHER_TEST) @@ -139,7 +139,7 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) + endif () foreach (def HAVE_SYS_TIME_H @@ -149,14 +149,14 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) ) if ("${${HDF_PREFIX}_${def}}") set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${${HDF_PREFIX}_${def}}") - endforeach (def) + endif () + endforeach () if (LARGEFILE) set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () #message (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} @@ -169,16 +169,16 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) if (${OTHER_TEST}) set (${HDF_PREFIX}_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") message (STATUS "Performing Other Test ${OTHER_TEST} - Success") - else (${OTHER_TEST}) + else () message (STATUS "Performing Other Test ${OTHER_TEST} - Failed") set (${HDF_PREFIX}_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Other Test ${OTHER_TEST} failed with the following output:\n" "${OUTPUT}\n" ) - endif (${OTHER_TEST}) - endif ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$") -ENDMACRO (HDF_FUNCTION_TEST) + endif () + endif () +ENDMACRO () #----------------------------------------------------------------------------- # Check for these functions before the time headers are checked @@ -192,8 +192,8 @@ MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) if (${VARIABLE}) set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) - endif (${VARIABLE}) -ENDMACRO (CHECK_INCLUDE_FILE_CONCAT) + endif () +ENDMACRO () #----------------------------------------------------------------------------- # Check for the existence of certain header files @@ -219,8 +219,8 @@ if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) -endif (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) + endif () +endif () # Darwin CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) @@ -229,16 +229,16 @@ CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_ CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) if (NOT CYGWIN) CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif (NOT CYGWIN) +endif () CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H) if (CMAKE_SYSTEM_NAME MATCHES "OSF") CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) -else (CMAKE_SYSTEM_NAME MATCHES "OSF") +else () set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif (CMAKE_SYSTEM_NAME MATCHES "OSF") +endif () CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) @@ -295,29 +295,29 @@ if (NOT WINDOWS) # check should be generalized for all POSIX systems as it # is in the Autotools. if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) + if (TEST_LFS_WORKS_RUN MATCHES 0) set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) set (LARGEFILE 1) set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) message (STATUS "${msg}... yes") - else (TEST_LFS_WORKS_RUN MATCHES 0) + else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" ) - endif (TEST_LFS_WORKS_RUN MATCHES 0) - else (TEST_LFS_WORKS_COMPILE ) + endif () + else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" ) - endif (TEST_LFS_WORKS_COMPILE) - endif (HDF_ENABLE_LARGE_FILE) + endif () + endif () set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) - endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) -endif (NOT WINDOWS) + endif () +endif () add_definitions (${HDF_EXTRA_FLAGS}) @@ -331,7 +331,7 @@ if (NOT WINDOWS OR MINGW) CHECK_FUNCTION_EXISTS (fseeko64 ${HDF_PREFIX}_HAVE_FSEEKO64) CHECK_FUNCTION_EXISTS (ftello64 ${HDF_PREFIX}_HAVE_FTELLO64) CHECK_FUNCTION_EXISTS (ftruncate64 ${HDF_PREFIX}_HAVE_FTRUNCATE64) - endif (${HDF_PREFIX}_HAVE_OFF64_T) + endif () CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO) CHECK_FUNCTION_EXISTS (ftello ${HDF_PREFIX}_HAVE_FTELLO) @@ -340,8 +340,8 @@ if (NOT WINDOWS OR MINGW) if (HAVE_STAT64_STRUCT) CHECK_FUNCTION_EXISTS (fstat64 ${HDF_PREFIX}_HAVE_FSTAT64) CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64) - endif (HAVE_STAT64_STRUCT) -endif (NOT WINDOWS OR MINGW) + endif () +endif () #----------------------------------------------------------------------------- # Check the size in bytes of all the int and float types @@ -354,8 +354,8 @@ MACRO (HDF_CHECK_TYPE_SIZE type var) if (NOT ${aVar}) set (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") # message (STATUS "Size of ${aType} was NOT Found") - endif (NOT ${aVar}) -ENDMACRO (HDF_CHECK_TYPE_SIZE) + endif () +ENDMACRO () HDF_CHECK_TYPE_SIZE (char ${HDF_PREFIX}_SIZEOF_CHAR) HDF_CHECK_TYPE_SIZE (short ${HDF_PREFIX}_SIZEOF_SHORT) @@ -363,12 +363,12 @@ HDF_CHECK_TYPE_SIZE (int ${HDF_PREFIX}_SIZEOF_INT) HDF_CHECK_TYPE_SIZE (unsigned ${HDF_PREFIX}_SIZEOF_UNSIGNED) if (NOT APPLE) HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) -endif (NOT APPLE) +endif () HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) if (NOT ${HDF_PREFIX}_SIZEOF___INT64) set (${HDF_PREFIX}_SIZEOF___INT64 0) -endif (NOT ${HDF_PREFIX}_SIZEOF___INT64) +endif () HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) @@ -407,17 +407,17 @@ if (NOT APPLE) HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) - endif (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) + endif () if (NOT WINDOWS) HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) - endif (NOT WINDOWS) -endif (NOT APPLE) + endif () +endif () HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T) if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) -endif (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) +endif () #----------------------------------------------------------------------------- # Extra C99 types @@ -428,9 +428,9 @@ CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) if (HAVE_STDBOOL_H) set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) -else (HAVE_STDBOOL_H) +else () HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) -endif (HAVE_STDBOOL_H) +endif () if (NOT WINDOWS) #----------------------------------------------------------------------------- @@ -459,11 +459,11 @@ if (NOT WINDOWS) HAVE_STRUCT_TM_TM_ZONE ) HDF_FUNCTION_TEST (${test}) - endforeach (test) + endforeach () if (NOT CYGWIN AND NOT MINGW) HDF_FUNCTION_TEST (HAVE_TIMEZONE) # HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - endif (NOT CYGWIN AND NOT MINGW) + endif () # ---------------------------------------------------------------------- # Does the struct stat have the st_blocks field? This field is not Posix. @@ -481,7 +481,7 @@ if (NOT WINDOWS) CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) if (NOT CYGWIN AND NOT MINGW) CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) - endif (NOT CYGWIN AND NOT MINGW) + endif () CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGETD) @@ -490,23 +490,31 @@ if (NOT WINDOWS) # if (NOT CYGWIN AND NOT MINGW) CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID) - endif (NOT CYGWIN AND NOT MINGW) -endif (NOT WINDOWS) + endif () +endif () #----------------------------------------------------------------------------- # Check for some functions that are used # CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM) +CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL) +CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK) CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK) CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF) CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME) CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE) +CHECK_FUNCTION_EXISTS (llround ${HDF_PREFIX}_HAVE_LLROUND) +CHECK_FUNCTION_EXISTS (llroundf ${HDF_PREFIX}_HAVE_LLROUNDF) +CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND) +CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF) CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT) CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) +CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND) +CHECK_FUNCTION_EXISTS (roundf ${HDF_PREFIX}_HAVE_ROUNDF) CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) @@ -531,8 +539,8 @@ CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) if (NOT WINDOWS) if (${HDF_PREFIX}_HAVE_VSNPRINTF) HDF_FUNCTION_TEST (VSNPRINTF_WORKS) - endif (${HDF_PREFIX}_HAVE_VSNPRINTF) -endif (NOT WINDOWS) + endif () +endif () #----------------------------------------------------------------------------- # sigsetjmp is special; may actually be a macro @@ -542,9 +550,9 @@ if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) - endif (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - endif (${HDF_PREFIX}_HAVE_SETJMP_H) -endif (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Check a bunch of other functions @@ -558,11 +566,10 @@ if (NOT WINDOWS) HAVE_C99_DESIGNATED_INITIALIZER SYSTEM_SCOPE_THREADS HAVE_SOCKLEN_T - CXX_HAVE_OFFSETOF ) HDF_FUNCTION_TEST (${test}) - endforeach (test) -endif (NOT WINDOWS) + endforeach () +endif () # For other CXX specific tests, use this MACRO. MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) @@ -571,7 +578,7 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) + endif () foreach (def HAVE_SYS_TIME_H @@ -581,14 +588,14 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) ) if ("${${HDF_PREFIX}_${def}}") set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${${HDF_PREFIX}_${def}}") - endforeach (def) + endif () + endforeach () if (LARGEFILE) set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () #message (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} @@ -601,16 +608,16 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) if (${OTHER_TEST} EQUAL 0) set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") message (STATUS "Performing CXX Test ${OTHER_TEST} - Success") - else (${OTHER_TEST} EQUAL 0) + else () message (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" "${OUTPUT}\n" ) - endif (${OTHER_TEST} EQUAL 0) - endif ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") -ENDMACRO (HDF_CXX_FUNCTION_TEST) + endif () + endif () +ENDMACRO () #----------------------------------------------------------------------------- # Check a bunch of cxx functions @@ -622,10 +629,11 @@ if (CMAKE_CXX_COMPILER_LOADED) ${HDF_PREFIX}_NO_STD BOOL_NOTDEFINED NO_STATIC_CAST + CXX_HAVE_OFFSETOF ) HDF_CXX_FUNCTION_TEST (${test}) - endforeach (test) -endif (CMAKE_CXX_COMPILER_LOADED) + endforeach () +endif () #----------------------------------------------------------------------------- # Check if InitOnceExecuteOnce is available @@ -638,21 +646,21 @@ if (WINDOWS) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () if (CMAKE_REQUIRED_INCLUDES) set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else (CMAKE_REQUIRED_INCLUDES) + else () set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif (CMAKE_REQUIRED_INCLUDES) + endif () TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED ${CMAKE_BINARY_DIR} @@ -666,7 +674,7 @@ if (WINDOWS) # if it did not compile make the return value fail code of 1 if (NOT HAVE_IOEO_COMPILED) set (HAVE_IOEO_EXITCODE 1) - endif (NOT HAVE_IOEO_COMPILED) + endif () # if the return value was 0 then it worked if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") @@ -675,22 +683,22 @@ if (WINDOWS) "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO}\n") - else ("${HAVE_IOEO_EXITCODE}" EQUAL 0) + else () if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") set (${HDF_PREFIX}_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") - else (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") + else () set (${HDF_PREFIX}_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") - endif (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") + endif () message (STATUS "Performing Test InitOnceExecuteOnce - Failed") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing InitOnceExecuteOnce Test failed with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO_EXITCODE}\n") - endif ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - endif ("${${HDF_PREFIX}_HAVE_IOEO}" MATCHES "^${${HDF_PREFIX}_HAVE_IOEO}$") - endif (NOT HDF_NO_IOEO_TEST) -endif (WINDOWS) + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- # Determine how 'inline' is used @@ -698,7 +706,7 @@ endif (WINDOWS) foreach (inline_test inline __inline__ __inline) string (TOUPPER ${inline_test} INLINE_TEST_MACRO) HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) -endforeach (inline_test) +endforeach () #----------------------------------------------------------------------------- # Check how to print a Long Long integer @@ -709,7 +717,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") if (${HDF_PREFIX}_SIZEOF_LONG_LONG) set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif (${HDF_PREFIX}_SIZEOF_LONG_LONG) + endif () TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c @@ -721,24 +729,24 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") set (PRINT_LL_FOUND 1) - else (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + else () message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - else (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + endif () + else () file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" ) - endif (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + endif () if (PRINT_LL_FOUND) message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - else (PRINT_LL_FOUND) + else () message (STATUS "Checking for appropriate format for 64 bit long: not found") set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll" ) - endif (PRINT_LL_FOUND) -endif (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") + endif () +endif () # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 5f0f031..1709c2b 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -32,38 +32,37 @@ MACRO (SZIP_ADJUST_LIB_VARS basename) set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE}) set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE}) set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE}) - endif (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) + endif () # if only the debug version was found, set the release variable also to the debug version if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG}) set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG}) set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) + endif () if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) # if the generator supports configuration types then set # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - else (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + else () # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + endif () set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) + endif () set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library") if (${basename}_LIBRARY) set (${basename}_FOUND 1) - endif (${basename}_LIBRARY) - - endif (${basename}_INCLUDE_DIR ) + endif () + endif () # Make variables changeble to the advanced user MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR ) -ENDMACRO (SZIP_ADJUST_LIB_VARS) +ENDMACRO () # Look for the header file. @@ -93,10 +92,10 @@ FIND_PATH (SZIP_INCLUDE_DIR if (WIN32) set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d") set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip") -else (WIN32) +else () set (SZIP_SEARCH_DEBUG_NAMES "sz_d") set (SZIP_SEARCH_RELEASE_NAMES "sz;szip") -endif (WIN32) +endif () # Look for the library. FIND_LIBRARY (SZIP_LIBRARY_DEBUG @@ -120,16 +119,15 @@ if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) if (SZIP_LIBRARY_DEBUG) get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH) set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - elseif (SZIP_LIBRARY_RELEASE) + elseif () get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH) set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - endif (SZIP_LIBRARY_DEBUG) - -else (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) + endif () +else () set (SZIP_FOUND 0) set (SZIP_LIBRARIES) set (SZIP_INCLUDE_DIRS) -endif (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) +endif () # Report the results. if (NOT SZIP_FOUND) @@ -138,12 +136,12 @@ if (NOT SZIP_FOUND) ) if (NOT SZIP_FIND_QUIETLY) message (STATUS "${SZIP_DIR_MESSAGE}") - else (NOT SZIP_FIND_QUIETLY) + else () if (SZIP_FIND_REQUIRED) message (FATAL_ERROR "SZip was NOT found and is Required by this project") - endif (SZIP_FIND_REQUIRED) - endif (NOT SZIP_FIND_QUIETLY) -endif (NOT SZIP_FOUND) + endif () + endif () +endif () if (SZIP_FOUND) include (CheckSymbolExists) @@ -161,7 +159,7 @@ if (SZIP_FOUND) set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) # ############################################# -endif (SZIP_FOUND) +endif () if (FIND_SZIP_DEBUG) message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}") @@ -169,4 +167,4 @@ if (FIND_SZIP_DEBUG) message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}") message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}") message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -endif (FIND_SZIP_DEBUG) +endif () diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp index 6b47421..f5f6644 100644 --- a/config/cmake_ext_mod/HDFCXXTests.cpp +++ b/config/cmake_ext_mod/HDFCXXTests.cpp @@ -54,3 +54,38 @@ int main(void) { } #endif + +#ifdef CXX_HAVE_OFFSETOF + +#include +#include + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus +extern "C" +# endif +int FC_DUMMY_MAIN() +{ return 1;} +#endif +#endif +int +main () +{ + + struct index_st + { + unsigned char type; + unsigned char num; + unsigned int len; + }; + typedef struct index_st index_t; + int x,y; + x = offsetof(struct index_st, len); + y = offsetof(index_t, num) + + ; + return 0; +} + +#endif diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 2145a3d..7d19b7a 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -51,7 +51,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) ##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) @@ -68,13 +68,13 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) add_dependencies (JPEG jpeg-shared) set (JPEG_SHARED_LIBRARY "jpeg-shared") set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}") set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src") set (JPEG_FOUND 1) set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR}) -endmacro (EXTERNAL_JPEG_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_JPEG_LIBRARY compress_type) @@ -85,8 +85,8 @@ macro (PACKAGE_JPEG_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (JPEG-GenHeader-Copy JPEG) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_JPEG_LIBRARY) + endif () +endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) @@ -141,7 +141,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) ##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) @@ -158,13 +158,13 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) add_dependencies (SZIP szip-shared) set (SZIP_SHARED_LIBRARY "szip-shared") set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") set (SZIP_FOUND 1) set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -endmacro (EXTERNAL_SZIP_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_SZIP_LIBRARY compress_type) @@ -175,8 +175,8 @@ macro (PACKAGE_SZIP_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (SZIP-GenHeader-Copy SZIP) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_SZIP_LIBRARY) + endif () +endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_ZLIB_LIBRARY compress_type) @@ -228,14 +228,14 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) if (WIN32) set (ZLIB_LIB_NAME "zlib") - else (WIN32) + else () set (ZLIB_LIB_NAME "z") - endif (WIN32) + endif () ##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target zlib-static add_library(zlib-static STATIC IMPORTED) @@ -250,13 +250,13 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) add_dependencies (ZLIB zlib-shared) set (ZLIB_SHARED_LIBRARY "zlib-shared") set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") set (ZLIB_FOUND 1) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -endmacro (EXTERNAL_ZLIB_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_ZLIB_LIBRARY compress_type) @@ -267,5 +267,5 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (ZLIB-GenHeader-Copy ZLIB) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_ZLIB_LIBRARY) + endif () +endmacro () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 1d6b49a..67a92d1 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------- macro (SET_GLOBAL_VARIABLE name value) set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) -endmacro (SET_GLOBAL_VARIABLE) +endmacro () #------------------------------------------------------------------------------- macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) @@ -14,7 +14,7 @@ macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) #set_property (SOURCE ${HEADERS} # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} #) -endmacro (IDE_GENERATED_PROPERTIES) +endmacro () #------------------------------------------------------------------------------- macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) @@ -31,14 +31,14 @@ macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) #set_property (SOURCE ${HEADERS} # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} #) -endmacro (IDE_SOURCE_PROPERTIES) +endmacro () #------------------------------------------------------------------------------- macro (TARGET_NAMING libtarget libtype) if (${libtype} MATCHES "SHARED") set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}${ARGN}") - endif (${libtype} MATCHES "SHARED") -endmacro (TARGET_NAMING) + endif () +endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) @@ -52,8 +52,8 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) CONFIGURATIONS RelWithDebInfo COMPONENT ${targetcomponent} ) - endif (WIN32 AND MSVC) -endmacro (INSTALL_TARGET_PDB) + endif () +endmacro () #------------------------------------------------------------------------------- macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) @@ -68,8 +68,8 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) CONFIGURATIONS RelWithDebInfo COMPONENT ${targetcomponent} ) - endif (WIN32 AND MSVC) -endmacro (INSTALL_PROGRAM_PDB) + endif () +endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) @@ -77,19 +77,19 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) if (WIN32) set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_D") - else (WIN32) + else () set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_debug") - endif (WIN32) - else (${libtype} MATCHES "SHARED") + endif () + else () if (WIN32) set (LIB_RELEASE_NAME "lib${libname}") set (LIB_DEBUG_NAME "lib${libname}_D") - else (WIN32) + else () set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_debug") - endif (WIN32) - endif (${libtype} MATCHES "SHARED") + endif () + endif () set_target_properties (${libtarget} PROPERTIES @@ -107,9 +107,9 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) IMPORT_PREFIX "" PREFIX "" ) - endif (MINGW AND ${libtype} MATCHES "SHARED") + endif () -endmacro (HDF_SET_LIB_OPTIONS) +endmacro () #------------------------------------------------------------------------------- macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) @@ -117,12 +117,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") - endif (${importtype} MATCHES "IMPORT") + endif () if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) - else (${CMAKE_BUILD_TYPE} MATCHES "Debug") + else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) - endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") + endif () if (${libtype} MATCHES "SHARED") if (WIN32) @@ -131,54 +131,54 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - else (MINGW) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - endif (MINGW) - else (WIN32) + endif () + else () if (CYGWIN) set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - else (CYGWIN) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${libversion}" SOVERSION "${libversion}" ) - endif (CYGWIN) - endif (WIN32) - else (${libtype} MATCHES "SHARED") + endif () + endif () + else () if (WIN32 AND NOT MINGW) set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - else (WIN32 AND NOT MINGW) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - endif (WIN32 AND NOT MINGW) - endif (${libtype} MATCHES "SHARED") + endif () + endif () -endmacro (HDF_IMPORT_SET_LIB_OPTIONS) +endmacro () #------------------------------------------------------------------------------- macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags) if (MSVC) TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - else (MSVC) + else () set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}" ) - endif (MSVC) -endmacro (TARGET_C_PROPERTIES) + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) @@ -188,15 +188,15 @@ macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}" ) - endif (MSVC) -endmacro (TARGET_MSVC_PROPERTIES) + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_FORTRAN_PROPERTIES forttarget libtype addcompileflags addlinkflags) if (WIN32) TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - endif (WIN32) -endmacro (TARGET_FORTRAN_PROPERTIES) + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkflags) @@ -207,15 +207,15 @@ macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkf COMPILE_FLAGS "/dll ${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" ) - else (${libtype} MATCHES "SHARED") + else () set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" ) - endif (${libtype} MATCHES "SHARED") - endif (MSVC) -endmacro (TARGET_FORTRAN_WIN_PROPERTIES) + endif () + endif () +endmacro () #----------------------------------------------------------------------------- # Configure the README.txt file for the binary package @@ -228,16 +228,16 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_INSTALL_ENDING "msi") if (CMAKE_CL_64) set (BINARY_SYSTEM_NAME "win64") - else (CMAKE_CL_64) + else () set (BINARY_SYSTEM_NAME "win32") - endif (CMAKE_CL_64) + endif () if (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3") set (BINARY_PLATFORM "${BINARY_PLATFORM} 10") - endif (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") + endif () set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") if (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2010") @@ -249,36 +249,36 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013") elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "19.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") - else (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") + else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") - endif (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") + endif () elseif (APPLE) set (BINARY_EXAMPLE_ENDING "tar.gz") set (BINARY_INSTALL_ENDING "dmg") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - else (WIN32) + else () set (BINARY_EXAMPLE_ENDING "tar.gz") set (BINARY_INSTALL_ENDING "sh") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - endif (WIN32) + endif () if (target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") - endif (target_fortran) + endif () if (BUILD_SHARED_LIBS) set (LIB_TYPE "Static and Shared") - else (BUILD_SHARED_LIBS) + else () set (LIB_TYPE "Static") - endif (BUILD_SHARED_LIBS) + endif () configure_file ( ${HDF_RESOURCES_DIR}/README.txt.cmake.in ${CMAKE_BINARY_DIR}/README.txt @ONLY ) -endmacro (HDF_README_PROPERTIES) +endmacro () macro (HDFTEST_COPY_FILE src dest target) add_custom_command( diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 8478d1b..648f795 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -389,55 +389,20 @@ int main(void) } #endif -#ifdef CXX_HAVE_OFFSETOF - -#include -#include - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - struct index_st - { - unsigned char type; - unsigned char num; - unsigned int len; - }; - typedef struct index_st index_t; - int x,y; - x = offsetof(struct index_st, len); - y = offsetof(index_t, num) - - ; - return 0; -} - -#endif - #ifdef HAVE_IOEO #include typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); int main () { - PGNSI pGNSI; - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), + PGNSI pGNSI; + pGNSI = (PGNSI) GetProcAddress( + GetModuleHandle(TEXT("kernel32.dll")), "InitOnceExecuteOnce"); - if(NULL == pGNSI) - return 1; - else - return 0; + if(NULL == pGNSI) + return 1; + else + return 0; } #endif /* HAVE_IOEO */ diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index 275f2ea..6a81e3a 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -31,9 +31,9 @@ MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 "${CODE}" @@ -63,8 +63,7 @@ MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") endif () - -ENDMACRO (CHECK_FORTRAN_FEATURE) +ENDMACRO () #----------------------------------------------------------------------------- # Configure Checks which require Fortran compilation must go in here @@ -75,7 +74,7 @@ ENDMACRO (CHECK_FORTRAN_FEATURE) #----------------------------------------------------------------------------- # Check for Non-standard extension intrinsic function SIZEOF -set(FORTRAN_HAVE_SIZEOF FALSE) +set (FORTRAN_HAVE_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(sizeof " PROGRAM main @@ -86,7 +85,7 @@ CHECK_FORTRAN_FEATURE(sizeof ) # Check for F2008 standard intrinsic function C_SIZEOF -set(FORTRAN_HAVE_C_SIZEOF FALSE) +set (FORTRAN_HAVE_C_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(c_sizeof " PROGRAM main @@ -112,7 +111,7 @@ CHECK_FORTRAN_FEATURE(storage_size ) # Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV" -set(HAVE_ISO_FORTRAN_ENV FALSE) +set (HAVE_ISO_FORTRAN_ENV FALSE) CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV " PROGRAM main @@ -122,7 +121,7 @@ CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV HAVE_ISO_FORTRAN_ENV ) -set(FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) +set (FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) CHECK_FORTRAN_FEATURE(RealIsNotDouble " MODULE type_mod @@ -152,7 +151,7 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble #----------------------------------------------------------------------------- # Checks if the ISO_C_BINDING module meets all the requirements #----------------------------------------------------------------------------- -set(FORTRAN_HAVE_ISO_C_BINDING FALSE) +set (FORTRAN_HAVE_ISO_C_BINDING FALSE) CHECK_FORTRAN_FEATURE(iso_c_binding " PROGRAM main @@ -175,5 +174,5 @@ if (CMAKE_Fortran_COMPILER MATCHES ifort) if (WIN32) set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) - endif (WIN32) -endif (CMAKE_Fortran_COMPILER MATCHES ifort) + endif () +endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index a090057..31c8421 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -4,25 +4,25 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) +endif () #if (NOT TEST_ARGS) # message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) +#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) +endif () #if (NOT TEST_EXPECT) # message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +#endif () if (NOT TEST_FILTER) message (STATUS "Require TEST_FILTER to be defined") -endif (NOT TEST_FILTER) +endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_REFERENCE) +endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") @@ -48,7 +48,7 @@ string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) if (${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") -endif (${TEST_RESULT} STREQUAL "0") +endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (${TEST_EXPECT} STREQUAL "1") @@ -56,8 +56,8 @@ if (${TEST_EXPECT} STREQUAL "1") string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif (NOT ${TEST_RESULT} STREQUAL "0") -endif (${TEST_EXPECT} STREQUAL "1") + endif () +endif () # everything went fine... message ("Passed: The output of ${TEST_PROGRAM} matched") diff --git a/config/cmake_ext_mod/prunTest.cmake b/config/cmake_ext_mod/prunTest.cmake deleted file mode 100644 index 38ecb7e..0000000 --- a/config/cmake_ext_mod/prunTest.cmake +++ /dev/null @@ -1,145 +0,0 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. -cmake_policy(SET CMP0007 NEW) - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif (NOT TEST_FILTER) -if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - -set (ERROR_APPEND 1) - -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") -endif (TEST_ENV_VAR) - -# run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_OUT - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) -file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) - -if (TEST_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") -endif (TEST_APPEND) - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -if (TEST_MASK) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:
\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK) - -if (TEST_MASK_MOD) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_MOD) - -if (TEST_MASK_ERROR) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_ERROR) - -if (TEST_FILTER) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_FILTER) - -#if (TEST_REF_FILTER) -# message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") -# file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) -# STRING(REGEX REPLACE "${TEST_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") -# file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") -#endif (TEST_REF_FILTER) - -if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) - - # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/P_${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/P_${TEST_REFERENCE} test_ref) - LIST (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - LIST (GET test_act ${line} str_act) - LIST (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) - - message (STATUS "COMPARE Result: ${TEST_RESULT}") - - # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match P_${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) -endif (NOT TEST_SKIP_COMPARE) - -# everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matches P_${TEST_REFERENCE}") - diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 1d8b12e..804c80f 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -6,9 +6,6 @@ cmake_policy(SET CMP0007 NEW) if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") endif () @@ -18,9 +15,6 @@ endif () if (NOT TEST_EXPECT) message (STATUS "Require TEST_EXPECT to be defined") endif () -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif () if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif () @@ -69,6 +63,16 @@ else () ) endif () +if (TEST_REGEX) + # TEST_REGEX should always be matched + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) + if (${REGEX_RESULT} STREQUAL "0") + message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") + endif () +endif () + message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled @@ -84,7 +88,13 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") + if (NOT TEST_NOERRDISPLAY) + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + message (STATUS "Output :\n${TEST_STREAM}") + endif() + endif() + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") @@ -125,7 +135,7 @@ if (TEST_MASK_ERROR) else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") endif () -endif (TEST_MASK_ERROR) +endif () # remove text from the output file if (TEST_FILTER) @@ -175,7 +185,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT ${len_act} STREQUAL ${len_ref}) set (TEST_RESULT 1) endif () - endif (NOT ${TEST_RESULT} STREQUAL 0) + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") @@ -214,7 +224,7 @@ if (NOT TEST_SKIP_COMPARE) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () - endforeach (line RANGE 0 ${_FP_LEN}) + endforeach () else () if (${len_act} STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") @@ -234,8 +244,8 @@ if (NOT TEST_SKIP_COMPARE) if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () - endif (TEST_ERRREF) -endif (NOT TEST_SKIP_COMPARE) + endif () +endif () # everything went fine... message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") diff --git a/configure b/configure index 8958ff1..954d612 100755 --- a/configure +++ b/configure @@ -30717,7 +30717,7 @@ else fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh testpar/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5repack/h5repack_plugin.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile tools/perform/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh testpar/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/h5dump_plugin.sh tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/Makefile tools/h5ls/h5ls_plugin.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/h5diff_plugin.sh tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5repack/h5repack_plugin.sh tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile tools/perform/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" cat >confcache <<\_ACEOF @@ -31999,13 +31999,17 @@ do "testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "tools/h5dump/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5dump/Makefile" ;; + "tools/h5dump/h5dump_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5dump/h5dump_plugin.sh" ;; "tools/h5dump/testh5dump.sh") CONFIG_FILES="$CONFIG_FILES tools/h5dump/testh5dump.sh" ;; "tools/h5dump/testh5dumppbits.sh") CONFIG_FILES="$CONFIG_FILES tools/h5dump/testh5dumppbits.sh" ;; "tools/h5dump/testh5dumpxml.sh") CONFIG_FILES="$CONFIG_FILES tools/h5dump/testh5dumpxml.sh" ;; + "tools/h5ls/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;; + "tools/h5ls/h5ls_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5ls/h5ls_plugin.sh" ;; "tools/h5ls/testh5ls.sh") CONFIG_FILES="$CONFIG_FILES tools/h5ls/testh5ls.sh" ;; "tools/h5import/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5import/Makefile" ;; "tools/h5import/h5importtestutil.sh") CONFIG_FILES="$CONFIG_FILES tools/h5import/h5importtestutil.sh" ;; "tools/h5diff/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5diff/Makefile" ;; + "tools/h5diff/h5diff_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5diff/h5diff_plugin.sh" ;; "tools/h5diff/testh5diff.sh") CONFIG_FILES="$CONFIG_FILES tools/h5diff/testh5diff.sh" ;; "tools/h5diff/testph5diff.sh") CONFIG_FILES="$CONFIG_FILES tools/h5diff/testph5diff.sh" ;; "tools/h5jam/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5jam/Makefile" ;; @@ -32013,7 +32017,6 @@ do "tools/h5repack/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5repack/Makefile" ;; "tools/h5repack/h5repack.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack.sh" ;; "tools/h5repack/h5repack_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack_plugin.sh" ;; - "tools/h5ls/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;; "tools/h5copy/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5copy/Makefile" ;; "tools/h5copy/testh5copy.sh") CONFIG_FILES="$CONFIG_FILES tools/h5copy/testh5copy.sh" ;; "tools/lib/Makefile") CONFIG_FILES="$CONFIG_FILES tools/lib/Makefile" ;; diff --git a/configure.ac b/configure.ac index 42295a1..28a3c8a 100644 --- a/configure.ac +++ b/configure.ac @@ -2929,13 +2929,17 @@ AC_CONFIG_FILES([src/libhdf5.settings testpar/Makefile tools/Makefile tools/h5dump/Makefile + tools/h5dump/h5dump_plugin.sh tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh + tools/h5ls/Makefile + tools/h5ls/h5ls_plugin.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile + tools/h5diff/h5diff_plugin.sh tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile @@ -2943,7 +2947,6 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5repack/h5repack_plugin.sh - tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 5876045..fcb1a30 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_H5DIFF) #----------------------------------------------------------------------------- @@ -45,7 +45,35 @@ if (BUILD_TESTING) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5diffgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () + + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) include (CMakeTests.cmake) diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index f2a7ab3..91e0cab 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -50,6 +50,8 @@ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5 ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5 ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 ) set (LIST_OTHER_TEST_FILES @@ -227,6 +229,8 @@ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_710.txt ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ) set (LIST_WIN_TEST_FILES @@ -238,6 +242,9 @@ # Make testfiles dir under build dir file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (H5_HAVE_PARALLEL) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") + endif () # # copy test files from source to build dir @@ -245,6 +252,9 @@ foreach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}" "h5diff_files") + endif () endforeach () @@ -255,11 +265,17 @@ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}.txt" "h5diff_files") + endif () endforeach () else () foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}.txt" "h5diff_files") + endif () endforeach () endif () add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) @@ -281,12 +297,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err - ) + else () add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -299,78 +310,85 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) endif () - ENDMACRO (ADD_H5_TEST file) + ENDMACRO () MACRO (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PH5DIFF-${resultfile} COMMAND $ ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN}) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME PH5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}_p.out ./testfiles/${resultfile}_p.out.err - ) + else () add_test ( NAME PH5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=P_${resultfile}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" # -D "TEST_APPEND=EXIT CODE: [0-9]" # -D "TEST_REF_FILTER=EXIT CODE: 0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/prunTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_PH5_TEST file) - - # ADD_H5_NO_OUTPUT_TEST - # Purpose to verify only exitcode without output comparison - # Don't use this if possible; this may be removed. - MACRO (ADD_H5_NO_OUTPUT_TEST testname resultcode) - # If using memchecker add tests without using scripts + endif () + ENDMACRO () + + MACRO (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run add_test ( - NAME H5DIFF-${testname}-clear-objects + NAME H5DIFF_UD-${testname}-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err ) - # if there was a previous test - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + if (${resultcode} STREQUAL "2") + add_test ( + NAME H5DIFF_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + else () + add_test ( + NAME H5DIFF_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) endif () - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - - add_test (NAME H5DIFF-${testname} COMMAND $ ${ARGN}) - if (NOT ${resultcode} STREQUAL "0") - set_tests_properties (H5DIFF-${testname} PROPERTIES WILL_FAIL "true") + set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS H5DIFF_UD-${testname}-clearall-objects) endif () - - if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS H5DIFF-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_NO_OUTPUT_TEST) + ENDMACRO () ############################################################################## ############################################################################## @@ -784,9 +802,9 @@ set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DIFF-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # ############################################################################ # # Common usage @@ -1357,3 +1375,9 @@ ADD_H5_TEST (h5diff_643 1 -v -d 5 --use-system-epsilon ${FILE1} ${FILE2} /g1/dse ADD_H5_TEST (h5diff_644 1 -v --use-system-epsilon -d 5 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) ADD_H5_TEST (h5diff_645 1 -v -p 0.05 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) + +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) +ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am index 7e3b620..0d01f14 100644 --- a/tools/h5diff/Makefile.am +++ b/tools/h5diff/Makefile.am @@ -44,6 +44,11 @@ check_PROGRAMS=$(TEST_PROG) check_SCRIPTS=$(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. SCRIPT_DEPEND=h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5diff_plugin.sh +endif +endif # Source files for the program h5diff_SOURCES=h5diff_main.c h5diff_common.c @@ -53,9 +58,20 @@ h5diffgentest_SOURCES=h5diffgentest.c # Programs depend on the main HDF5 library and tools library LDADD=$(LIBH5TOOLS) $(LIBHDF5) +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibdiff.la + libdynlibdiff_la_SOURCES=dynlib_diff.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5diff. They should # be copied to the testfiles/ directory if update is required CHECK_CLEANFILES+=*.h5 expect_sorted actual_sorted +DISTCLEANFILES=h5diff_plugin.sh + include $(top_srcdir)/config/conclude.am diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 92ec96d..a6bb1d1 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -31,6 +31,7 @@ # HDF5 Library Makefile(.in) # + VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -107,6 +108,7 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = h5diff$(EXEEXT) $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) +@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5diff_plugin.sh TESTS = $(am__EXEEXT_2) $(TEST_SCRIPT) subdir = tools/h5diff ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -117,20 +119,55 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = testh5diff.sh testph5diff.sh +CONFIG_CLEAN_FILES = h5diff_plugin.sh testh5diff.sh testph5diff.sh CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdynlibdiff_la_LIBADD = +am__libdynlibdiff_la_SOURCES_DIST = dynlib_diff.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibdiff_la_OBJECTS = \ +@HAVE_SHARED_CONDITIONAL_TRUE@ dynlib_diff.lo +libdynlibdiff_la_OBJECTS = $(am_libdynlibdiff_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibdiff_la_rpath = -rpath \ +@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir) @BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = ph5diff$(EXEEXT) -am__installdirs = "$(DESTDIR)$(bindir)" am__EXEEXT_2 = h5diffgentest$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_h5diff_OBJECTS = h5diff_main.$(OBJEXT) h5diff_common.$(OBJEXT) h5diff_OBJECTS = $(am_h5diff_OBJECTS) h5diff_LDADD = $(LDADD) h5diff_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = h5diff_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(h5diff_LDFLAGS) $(LDFLAGS) -o $@ @@ -176,10 +213,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(h5diff_SOURCES) $(h5diffgentest_SOURCES) \ - $(ph5diff_SOURCES) -DIST_SOURCES = $(h5diff_SOURCES) $(h5diffgentest_SOURCES) \ - $(ph5diff_SOURCES) +SOURCES = $(libdynlibdiff_la_SOURCES) $(h5diff_SOURCES) \ + $(h5diffgentest_SOURCES) $(ph5diff_SOURCES) +DIST_SOURCES = $(am__libdynlibdiff_la_SOURCES_DIST) $(h5diff_SOURCES) \ + $(h5diffgentest_SOURCES) $(ph5diff_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -226,33 +263,6 @@ am__tty_colors = { \ std=''; \ fi; \ } -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* @@ -406,10 +416,10 @@ am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testh5diff.sh.in \ - $(srcdir)/testph5diff.sh.in $(top_srcdir)/bin/depcomp \ - $(top_srcdir)/bin/mkinstalldirs $(top_srcdir)/bin/test-driver \ - $(top_srcdir)/config/commence.am \ +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/h5diff_plugin.sh.in \ + $(srcdir)/testh5diff.sh.in $(srcdir)/testph5diff.sh.in \ + $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ + $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -696,7 +706,7 @@ h5diff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Test programs and scripts TEST_PROG = h5diffgentest -TEST_SCRIPT = testh5diff.sh +TEST_SCRIPT = testh5diff.sh $(am__append_1) check_SCRIPTS = $(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. SCRIPT_DEPEND = h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh @@ -708,6 +718,9 @@ h5diffgentest_SOURCES = h5diffgentest.c # Programs depend on the main HDF5 library and tools library LDADD = $(LIBH5TOOLS) $(LIBHDF5) +@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibdiff.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlibdiff_la_SOURCES = dynlib_diff.c +DISTCLEANFILES = h5diff_plugin.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -762,10 +775,50 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +h5diff_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5diff_plugin.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5diff.sh: $(top_builddir)/config.status $(srcdir)/testh5diff.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testph5diff.sh: $(top_builddir)/config.status $(srcdir)/testph5diff.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libdynlibdiff_la_rpath) $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -843,6 +896,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib_diff.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5diff_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5diff_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5diffgentest.Po@am__quote@ @@ -1113,9 +1167,11 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1147,14 +1203,16 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SHARED_CONDITIONAL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool mostlyclean-am + clean-libLTLIBRARIES clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -1180,8 +1238,9 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS - +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -1220,25 +1279,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES -.MAKE: check-am install-am install-strip +.MAKE: check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ check-am clean clean-binPROGRAMS clean-checkPROGRAMS \ - clean-generic clean-libtool cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS + uninstall-binPROGRAMS uninstall-libLTLIBRARIES .PRECIOUS: Makefile @@ -1254,6 +1314,11 @@ uninstall-am: uninstall-binPROGRAMS help: @$(top_srcdir)/bin/makehelp +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. + +@HAVE_SHARED_CONDITIONAL_TRUE@install-exec-hook: +@HAVE_SHARED_CONDITIONAL_TRUE@ $(RM) $(DESTDIR)$(libdir)/*dynlib* + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5diff/dynlib_diff.c b/tools/h5diff/dynlib_diff.c new file mode 100644 index 0000000..0d8be2b --- /dev/null +++ b/tools/h5diff/dynlib_diff.c @@ -0,0 +1,94 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* + * Programmer: Raymond Lu + * 13 February 2013 + * + * Purpose: Tests the plugin module (H5PL) + */ + +#include +#include +#include "H5PLextern.h" + +#define H5Z_FILTER_DYNLIB2 258 +#define MULTIPLIER 3 + +static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIB2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib2 + * + * Purpose: A dynlib2 filter method that multiplies the original value + * during write and divide the original value during read. It + * will be built as a shared library. plugin.c test will load + * and use this filter library. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + * Programmer: Raymond Lu + * 29 March 2013 + * + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if(cd_nelmts > 0) + return(0); + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Divide the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ /= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Multiply the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ *= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlib2() */ + diff --git a/tools/h5diff/h5diff_plugin.sh.in b/tools/h5diff/h5diff_plugin.sh.in new file mode 100644 index 0000000..3f39d4c --- /dev/null +++ b/tools/h5diff/h5diff_plugin.sh.in @@ -0,0 +1,299 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +H5DIFF=h5diff # The tool name +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary + +nerrors=0 +verbose=yes +h5haveexitcode=yes # default is yes + +TEST_NAME=h5diff_ud_plugin +FROM_DIR=`pwd`/.libs +PLUGIN_LIB="$FROM_DIR/libdynlibdiff.*" +PLUGIN_LIBDIR=testdir3 + +RM='rm -rf' +CMP='cmp -s' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# source dirs +SRC_TOOLS="$srcdir/.." + +# testfiles source dirs for tools +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" + +TESTDIR=./testplug +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5DIFF_TESTFILES/tudfilter.h5 +$SRC_H5DIFF_TESTFILES/tudfilter2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_ud.txt +$SRC_H5DIFF_TESTFILES/h5diff_udfail.txt +" + +# Main Body +# Create test directories if not exists yet. +test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to create test directory($PLUGIN_LIBDIR)" + exit $EXIT_FAILURE +fi + +# copy plugin library for test +$CP $PLUGIN_LIB $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB) for test." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp 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 + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + 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=$SRC_H5DIFF_TESTFILES + 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 +} + +# Parse option +# -p run ph5diff tests +# -h print help page +while [ $# -gt 0 ]; do + case "$1" in + -p) # reset the tool name and bin to run ph5diff tests + TESTNAME=ph5diff + H5DIFF=ph5diff # The tool name + H5DIFF_BIN=`pwd`/$H5DIFF + pmode=yes + shift + ;; + -h) # print help page + echo "$0 [-p] [-h]" + echo " -p run ph5diff tests" + echo " -h print help page" + shift + exit 0 + ;; + *) # unknown option + echo "$0: Unknown option ($1)" + exit 1 + ;; + esac +done + +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# +# Need eval before the RUNCMD command because some machines like +# AIX, has RUNPARALLEL in the style as +# MP_PROCS=3 MP_TASKS_PER_NODE=3 poe ./a.out +# that throws the shell script off. +# +TOOLTEST() { + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + if test -n "$pmode"; then + RUNCMD=$RUNPARALLEL + else + RUNCMD=$RUNSERIAL + fi + + # Run test. + TESTING $H5DIFF $@ + ( + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + ) >$actual 2>$actual_err + EXIT_CODE=$? + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + # don't add exit code check in pmode, as it causes failure. (exit code + # is from mpirun not tool) + # if any problem occurs relate to an exit code, it will be caught in + # serial mode, so the test is fullfilled. + if test $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "EXIT CODE: $EXIT_CODE" >> $actual + fi + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "*FAILED*" + echo " Expected result ($expect) differs from actual result ($actual)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + else + # parallel mode output are often of different ordering from serial + # output. If the sorted expected and actual files compare the same, + # it is safe to assume the actual output match the expected file. + expect_sorted=expect_sorted + actual_sorted=actual_sorted + sort $expect -o $expect_sorted + sort $actual -o $actual_sorted + # remove "EXIT CODE:" line from expect file. test for exit code + # is done by serial mode. + grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit + mv $expect_sorted.noexit $expect_sorted + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi + fi + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted + fi +} + +############################################################################## +### T H E T E S T S +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +# Run the test +TOOLTEST h5diff_ud.txt -v tudfilter.h5 tudfilter2.h5 + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All Plugin API tests passed." + 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/h5diff/testfiles/h5diff_ud.txt b/tools/h5diff/testfiles/h5diff_ud.txt new file mode 100644 index 0000000..7c9bb5e --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_ud.txt @@ -0,0 +1,11 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dynlib2 + +group : and +0 differences found +dataset: and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_udfail.txt b/tools/h5diff/testfiles/h5diff_udfail.txt new file mode 100644 index 0000000..7eb1155 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_udfail.txt @@ -0,0 +1,12 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dynlib2 + +group : and +0 differences found +dataset: and +0 differences found +warning: dataset cannot be read, user defined filter is not available +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/tudfilter.h5 b/tools/h5diff/testfiles/tudfilter.h5 new file mode 100644 index 0000000..a1f6d80 Binary files /dev/null and b/tools/h5diff/testfiles/tudfilter.h5 differ diff --git a/tools/h5diff/testfiles/tudfilter2.h5 b/tools/h5diff/testfiles/tudfilter2.h5 new file mode 100644 index 0000000..a1f6d80 Binary files /dev/null and b/tools/h5diff/testfiles/tudfilter2.h5 differ diff --git a/tools/h5diff/testh5diff.sh.in b/tools/h5diff/testh5diff.sh.in index 3be0b80..5748128 100644 --- a/tools/h5diff/testh5diff.sh.in +++ b/tools/h5diff/testh5diff.sh.in @@ -331,10 +331,10 @@ COPY_TESTFILES_TO_TESTDIR() 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 - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -348,7 +348,7 @@ 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` + SDIR=$SRC_H5DIFF_TESTFILES 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 @@ -369,16 +369,16 @@ while [ $# -gt 0 ]; do shift ;; -h) # print help page - echo "$0 [-p] [-h]" - echo " -p run ph5diff tests" - echo " -h print help page" - shift - exit 0 - ;; + echo "$0 [-p] [-h]" + echo " -p run ph5diff tests" + echo " -h print help page" + shift + exit 0 + ;; *) # unknown option echo "$0: Unknown option ($1)" - exit 1 - ;; + exit 1 + ;; esac done @@ -429,11 +429,11 @@ TOOLTEST() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? # save actual and actual_err in case they are needed later. @@ -442,9 +442,9 @@ TOOLTEST() { cp $actual_err $actual_err_sav STDERR_FILTER $actual_err cat $actual_err >> $actual - # don't add exit code check in pmode, as it causes failure. (exit code + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) - # if any problem occurs relate to an exit code, it will be caught in + # if any problem occurs relate to an exit code, it will be caught in # serial mode, so the test is fullfilled. if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual @@ -462,7 +462,7 @@ TOOLTEST() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' else - # parallel mode output are often of different ordering from serial + # parallel mode output are often of different ordering from serial # output. If the sorted expected and actual files compare the same, # it is safe to assume the actual output match the expected file. expect_sorted=expect_sorted @@ -473,44 +473,44 @@ TOOLTEST() { # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" - fi - fi + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi + fi fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav - rm -f $actual_sorted $expect_sorted + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted fi } # Print a "SKIP" message SKIP() { - TESTING $H5DIFF $@ - echo " -SKIP-" + TESTING $H5DIFF $@ + echo " -SKIP-" } ############################################################################## -# The tests +# The tests # To avoid the printing of the complete full path of the test file, that hides -# all the other parameters for long paths, the printing of the command line +# all the other parameters for long paths, the printing of the command line # is done first in # TESTING with the name only of the test file $TOOL, not its full path $TESTFILE ############################################################################## @@ -525,13 +525,13 @@ COPY_TESTFILES_TO_TESTDIR TOOLTEST h5diff_10.txt -h # 1.1 normal mode -TOOLTEST h5diff_11.txt h5diff_basic1.h5 h5diff_basic2.h5 +TOOLTEST h5diff_11.txt h5diff_basic1.h5 h5diff_basic2.h5 # 1.2 normal mode with objects TOOLTEST h5diff_12.txt h5diff_basic1.h5 h5diff_basic2.h5 g1/dset1 g1/dset2 # 1.3 report mode -TOOLTEST h5diff_13.txt -r h5diff_basic1.h5 h5diff_basic2.h5 +TOOLTEST h5diff_13.txt -r h5diff_basic1.h5 h5diff_basic2.h5 # 1.4 report mode with objects TOOLTEST h5diff_14.txt -r h5diff_basic1.h5 h5diff_basic2.h5 g1/dset1 g1/dset2 @@ -549,7 +549,7 @@ TOOLTEST h5diff_16_2.txt --verbose --relative=0.02 h5diff_basic1.h5 h5diff_basic TOOLTEST h5diff_16_3.txt -v -p 0.02 h5diff_basic1.h5 h5diff_basic1.h5 g1/dset9 g1/dset10 # 1.7 verbose mode -TOOLTEST h5diff_17.txt -v h5diff_basic1.h5 h5diff_basic2.h5 +TOOLTEST h5diff_17.txt -v h5diff_basic1.h5 h5diff_basic2.h5 # 1.7 test 32-bit INFINITY TOOLTEST h5diff_171.txt -v h5diff_basic1.h5 h5diff_basic1.h5 /g1/fp19 /g1/fp19_COPY @@ -557,8 +557,8 @@ TOOLTEST h5diff_171.txt -v h5diff_basic1.h5 h5diff_basic1.h5 /g1/fp19 /g1/fp19_C # 1.7 test 64-bit INFINITY TOOLTEST h5diff_172.txt -v h5diff_basic1.h5 h5diff_basic1.h5 /g1/fp20 /g1/fp20_COPY -# 1.8 quiet mode -TOOLTEST h5diff_18.txt -q h5diff_basic1.h5 h5diff_basic2.h5 +# 1.8 quiet mode +TOOLTEST h5diff_18.txt -q h5diff_basic1.h5 h5diff_basic2.h5 # 1.8 -v and -q TOOLTEST h5diff_18_1.txt -v -q h5diff_basic1.h5 h5diff_basic2.h5 @@ -588,7 +588,7 @@ TOOLTEST h5diff_23.txt -v h5diff_types.h5 h5diff_types.h5 g1 g1 TOOLTEST h5diff_24.txt -v h5diff_types.h5 h5diff_types.h5 t1 t1 # 2.5 -TOOLTEST h5diff_25.txt -v h5diff_types.h5 h5diff_types.h5 l1 l1 +TOOLTEST h5diff_25.txt -v h5diff_types.h5 h5diff_types.h5 l1 l1 # 2.6 TOOLTEST h5diff_26.txt -v h5diff_types.h5 h5diff_types.h5 g1 g2 @@ -642,7 +642,7 @@ TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b # 5.8 (region reference) TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg -# test for both dset and attr with same type but with different size +# test for both dset and attr with same type but with different size # ( HDDFV-7942 ) TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b @@ -652,14 +652,14 @@ TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b # 6.0: Check if the command line number of arguments is less than 3 -TOOLTEST h5diff_600.txt h5diff_basic1.h5 +TOOLTEST h5diff_600.txt h5diff_basic1.h5 -# 6.1: Check if non-exist object name is specified +# 6.1: Check if non-exist object name is specified TOOLTEST h5diff_601.txt h5diff_basic1.h5 h5diff_basic1.h5 nono_obj # ############################################################################## -# # -d +# # -d # ############################################################################## @@ -678,7 +678,7 @@ TOOLTEST h5diff_606.txt -d 0x1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dse # 6.7: string TOOLTEST h5diff_607.txt -d "1" h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 -# 6.8: use system epsilon +# 6.8: use system epsilon TOOLTEST h5diff_608.txt --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 # 6.9: number larger than biggest difference @@ -762,7 +762,7 @@ TOOLTEST h5diff_631.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h # ############################################################################## # 7. attributes # ############################################################################## -TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5 +TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5 # temporary test to verify HDF5-8625 TOOLTEST h5diff_tmp1.txt tmptest2.he5 tmptest.he5 # temporary test to verify HDF5-8639 @@ -772,10 +772,10 @@ TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.referen # attrs with verbose option level # ################################################## -TOOLTEST h5diff_700.txt -v1 h5diff_attr1.h5 h5diff_attr2.h5 -TOOLTEST h5diff_701.txt -v2 h5diff_attr1.h5 h5diff_attr2.h5 -TOOLTEST h5diff_702.txt --verbose=1 h5diff_attr1.h5 h5diff_attr2.h5 -TOOLTEST h5diff_703.txt --verbose=2 h5diff_attr1.h5 h5diff_attr2.h5 +TOOLTEST h5diff_700.txt -v1 h5diff_attr1.h5 h5diff_attr2.h5 +TOOLTEST h5diff_701.txt -v2 h5diff_attr1.h5 h5diff_attr2.h5 +TOOLTEST h5diff_702.txt --verbose=1 h5diff_attr1.h5 h5diff_attr2.h5 +TOOLTEST h5diff_703.txt --verbose=2 h5diff_attr1.h5 h5diff_attr2.h5 # same attr number , all same attr name TOOLTEST h5diff_704.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g @@ -789,7 +789,7 @@ TOOLTEST h5diff_706.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /nty # different attr number , same attr name (intersected) TOOLTEST h5diff_707.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g2 -# different attr number , all different attr name +# different attr number , all different attr name TOOLTEST h5diff_708.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g3 # when no attributes exist in both objects @@ -801,32 +801,32 @@ TOOLTEST h5diff_710.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 # ############################################################################## # 8. all dataset datatypes # ############################################################################## -TOOLTEST h5diff_80.txt -v h5diff_dset1.h5 h5diff_dset2.h5 +TOOLTEST h5diff_80.txt -v h5diff_dset1.h5 h5diff_dset2.h5 # 9. compare a file with itself TOOLTEST h5diff_90.txt -v h5diff_basic2.h5 h5diff_basic2.h5 # 10. read by hyperslab, print indexes -TOOLTEST h5diff_100.txt -v h5diff_hyper1.h5 h5diff_hyper2.h5 +TOOLTEST h5diff_100.txt -v h5diff_hyper1.h5 h5diff_hyper2.h5 # 11. floating point comparison # double value -TOOLTEST h5diff_101.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2 +TOOLTEST h5diff_101.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2 # float value -TOOLTEST h5diff_102.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2 +TOOLTEST h5diff_102.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2 -# with --use-system-epsilon for double value -TOOLTEST h5diff_103.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2 +# with --use-system-epsilon for double value +TOOLTEST h5diff_103.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2 # with --use-system-epsilon for float value -TOOLTEST h5diff_104.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2 +TOOLTEST h5diff_104.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2 # not comparable -c flag -TOOLTEST h5diff_200.txt h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2 +TOOLTEST h5diff_200.txt h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2 -TOOLTEST h5diff_201.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2 +TOOLTEST h5diff_201.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2 TOOLTEST h5diff_202.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset2 g2/dset3 @@ -842,9 +842,9 @@ TOOLTEST h5diff_206.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset7 g2/dset8 TOOLTEST h5diff_207.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset8 g2/dset9 # not comparable in dataspace of zero dimension size -TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5 +TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5 -# non-comparable dataset with comparable attribute, and other comparable datasets. +# non-comparable dataset with comparable attribute, and other comparable datasets. # Also test non-compatible attributes with different type, dimention, rank. # All the comparables should display differences. TOOLTEST h5diff_220.txt -c non_comparables1.h5 non_comparables2.h5 /g1 @@ -862,7 +862,7 @@ TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5 TOOLTEST h5diff_223.txt -c non_comparables1.h5 non_comparables2.h5 /diffobjtypes # swap files TOOLTEST h5diff_224.txt -c non_comparables2.h5 non_comparables1.h5 /diffobjtypes - + # ############################################################################## # # Links compare without --follow-symlinks nor --no-dangling-links # ############################################################################## @@ -958,28 +958,28 @@ TOOLTEST h5diff_425.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_e TOOLTEST h5diff_450.txt --follow-symlinks -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 # dangling links --follow-symlinks and --no-dangling-links (FILE to FILE) -TOOLTEST h5diff_451.txt --follow-symlinks -v --no-dangling-links h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 +TOOLTEST h5diff_451.txt --follow-symlinks -v --no-dangling-links h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 # try --no-dangling-links without --follow-symlinks options TOOLTEST h5diff_452.txt --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 # dangling link found for soft links (FILE to FILE) -TOOLTEST h5diff_453.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 +TOOLTEST h5diff_453.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 # dangling link found for soft links (obj to obj) -TOOLTEST h5diff_454.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset2 /softlink_noexist +TOOLTEST h5diff_454.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset2 /softlink_noexist # dangling link found for soft links (obj to obj) Both dangle links -TOOLTEST h5diff_455.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_noexist /softlink_noexist +TOOLTEST h5diff_455.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_noexist /softlink_noexist # dangling link found for ext links (FILE to FILE) -TOOLTEST h5diff_456.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 +TOOLTEST h5diff_456.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 # dangling link found for ext links (obj to obj). target file exist -TOOLTEST h5diff_457.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist1 +TOOLTEST h5diff_457.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist1 # dangling link found for ext links (obj to obj). target file NOT exist -TOOLTEST h5diff_458.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist2 +TOOLTEST h5diff_458.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist2 # dangling link found for ext links (obj to obj). Both dangle links TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_noexist2 @@ -993,14 +993,14 @@ TOOLTEST h5diff_466.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dangl # soft link vs. soft dangling TOOLTEST h5diff_467.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2 # ext dangling vs. ext dangling -TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 +TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 # ext link vs. ext dangling TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2 #---------------------------------------- -# dangling links without follow symlink +# dangling links without follow symlink # (HDFFV-7998) -# test - soft dangle links (same and different paths), +# test - soft dangle links (same and different paths), # - external dangle links (same and different paths) TOOLTEST h5diff_471.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 TOOLTEST h5diff_472.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 @@ -1011,7 +1011,7 @@ TOOLTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_li # ############################################################################## # # test for group diff recursivly # ############################################################################## -# root +# root TOOLTEST h5diff_500.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / TOOLTEST h5diff_501.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / @@ -1045,7 +1045,7 @@ TOOLTEST h5diff_513.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_ TOOLTEST h5diff_514.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11 ############################################################################### -# Test for group recursive diff via multi-linked external links +# Test for group recursive diff via multi-linked external links # With follow-symlinks, file h5diff_grp_recurse_ext1.h5 and h5diff_grp_recurse_ext2-1.h5 should # be same with the external links. ############################################################################### @@ -1068,7 +1068,7 @@ TOOLTEST h5diff_480.txt -v --exclude-path /group1/dset3 h5diff_exclude1-1.h5 h5d TOOLTEST h5diff_481.txt -v h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 # -# Different structure, different names. +# Different structure, different names. # # Exclude all the different objects. Expect return - same TOOLTEST h5diff_482.txt -v --exclude-path "/group1" --exclude-path "/dset1" h5diff_exclude2-1.h5 h5diff_exclude2-2.h5 @@ -1099,9 +1099,9 @@ TOOLTEST h5diff_530.txt -v h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group TOOLTEST h5diff_540.txt -v compounds_array_vlen1.h5 compounds_array_vlen2.h5 # ############################################################################## -# # Test mutually exclusive options +# # Test mutually exclusive options # ############################################################################## -# Test with -d , -p and --use-system-epsilon. +# Test with -d , -p and --use-system-epsilon. TOOLTEST h5diff_640.txt -v -d 5 -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 TOOLTEST h5diff_641.txt -v -d 5 -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 TOOLTEST h5diff_642.txt -v -p 0.05 -d 5 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 38cf12d..c81765c 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_H5DUMP) #----------------------------------------------------------------------------- @@ -23,6 +23,35 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") set (H5_DEP_EXECUTABLES h5dump) if (BUILD_TESTING) + + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + # -------------------------------------------------------------------- # Add the h5dump test executable # -------------------------------------------------------------------- @@ -34,7 +63,7 @@ if (BUILD_TESTING) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5dumpgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index d563e44..55635d4 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -165,6 +165,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tstring2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tstringe.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tszip.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudfilter.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink-2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tuserfilter.ddl @@ -281,6 +282,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr2.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr3.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2.h5 @@ -328,26 +330,26 @@ foreach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) get_filename_component (fname "${tst_h5_file}" NAME) HDFTEST_COPY_FILE("${tst_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") - endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") - else (WIN32) + else () HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") - endif (WIN32) - endforeach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) + endif () + endforeach () foreach (tst_other_file ${HDF5_REFERENCE_FILES}) get_filename_component (fname "${tst_other_file}" NAME) HDFTEST_COPY_FILE("${tst_other_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") - endforeach (tst_other_file ${HDF5_REFERENCE_FILES}) + endforeach () foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) get_filename_component (fname "${tst_error_file}" NAME) HDFTEST_COPY_FILE("${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") - endforeach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) + endforeach () # -------------------------------------------------------------------- # Special file handling @@ -357,9 +359,9 @@ if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") - else (WIN32) + else () HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") - endif (WIN32) + endif () add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list}) ############################################################################## @@ -375,15 +377,9 @@ set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DUMP-${testname}") - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5DUMP-h5dump-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove h5dump-${testname}.out h5dump-${testname}.out.err - ) - set_tests_properties (H5DUMP-h5dump-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + else () add_test ( NAME H5DUMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" @@ -395,9 +391,8 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-h5dump-${testname} PROPERTIES DEPENDS "H5DUMP-h5dump-${testname}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_HELP_TEST) + endif () + ENDMACRO () MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) if (${testtype} STREQUAL "SKIP") @@ -406,11 +401,11 @@ NAME H5DUMP-${skipresultfile}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + endif () + else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) - endif (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_SKIP_H5_TEST) + endif () + ENDMACRO () MACRO (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts @@ -419,15 +414,15 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.bin ${resultfile}.out ${resultfile}.out.err + -E remove ${resultfile}.bin ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -442,8 +437,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST file) + endif () + ENDMACRO () MACRO (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts @@ -452,15 +447,15 @@ set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-N-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}-N.bin ${resultfile}-N.out ${resultfile}-N.out.err + -E remove ${resultfile}-N.bin ) set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -471,12 +466,12 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}-N.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_REFERENCE=${resultfile}-N.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_N file) + endif () + ENDMACRO () MACRO (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts @@ -485,15 +480,15 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.txt ${resultfile}.out ${resultfile}.out.err + -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -515,8 +510,8 @@ ) set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_EXPORT file) + endif () + ENDMACRO () MACRO (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts @@ -525,15 +520,15 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${ddlfile}.txt ${resultfile}.txt ${resultfile}.out ${resultfile}.out.err + -E remove ${ddlfile}.txt ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -562,8 +557,8 @@ ) set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_EXPORT_DDL file) + endif () + ENDMACRO () MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -586,18 +581,12 @@ ) set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_EXPORT_TEST file) + endif () + ENDMACRO () MACRO (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -609,19 +598,12 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_MASK_TEST file) + endif () + ENDMACRO () MACRO (ADD_H5ERR_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -634,19 +616,12 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5ERR_MASK_TEST file) + endif () + ENDMACRO () MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -661,9 +636,8 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5ERR_MASK_ENV_TEST) + endif () + ENDMACRO () MACRO (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) # If using memchecker add tests without using scripts @@ -671,7 +645,7 @@ add_test ( NAME H5DUMP-IMPORT-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${conffile}.out ${conffile}.out.err ${resultfile}.bin ${resultfile}.h5 + -E remove ${resultfile}.bin ${resultfile}.h5 ) set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -692,12 +666,39 @@ add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_IMPORT file) + endif () + ENDMACRO () + + MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP_UD-${testname}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/std/${resultfile}.out + testfiles/std/${resultfile}.out.err + ) + add_test ( + NAME H5DUMP_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clearall-objects) + endif () + ENDMACRO () ############################################################################## ############################################################################## -### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ### +### T H E T E S T S ### ############################################################################## ############################################################################## @@ -1051,9 +1052,9 @@ set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DUMP-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () ADD_HELP_TEST(help 0 -h) @@ -1110,10 +1111,10 @@ ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5) # test for header and error messages ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) - # test for displaying attributes in shared datatype (also in group and dataset) - ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying at least 9 attributes on root from a be machine ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5) + # test for displaying attributes in shared datatype (also in group and dataset) + ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying soft links and user-defined links ADD_H5_TEST (tslink-1 0 --enable-error-stack tslink.h5) @@ -1333,11 +1334,11 @@ # detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) + endif () if (USE_FILTER_DEFLATE) # data read internal filters @@ -1345,8 +1346,8 @@ if (HDF5_ENABLE_SZIP_SUPPORT) # data read all filters ADD_H5_TEST (treadfilter 0 --enable-error-stack -d all -d szip tfilters.h5) - endif (HDF5_ENABLE_SZIP_SUPPORT) - endif (USE_FILTER_DEFLATE) + endif () + endif () # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) @@ -1381,14 +1382,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o tbin2.bin tbinary.h5) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () # the NATIVE test can be validated with h5import/h5diff ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE) if (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) @@ -1433,3 +1434,8 @@ # test for non-existing file ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) + +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index 72f8dfb..e6265dc 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -88,18 +88,18 @@ foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) get_filename_component(fname "${pbits_h5_file}" NAME) HDFTEST_COPY_FILE("${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) + endforeach () foreach (ddl_pbits ${HDF5_REFERENCE_PBITS}) get_filename_component(fname "${ddl_pbits}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS}) + endforeach () foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) get_filename_component(fname "${ddl_pbits}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) + endforeach () add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list}) ############################################################################## @@ -121,12 +121,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -137,9 +131,8 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_PBITS_TEST file) + endif () + ENDMACRO () ############################################################################## ############################################################################## @@ -263,9 +256,9 @@ set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (NOT "${last_pbits_test}" STREQUAL "") set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) - endif (NOT "${last_pbits_test}" STREQUAL "") + endif () set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # test failure handling # Missing file name diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index 44d24df..6cdc81c 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -130,12 +130,12 @@ foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) get_filename_component(fname "${tst_xml_h5_file}" NAME) HDFTEST_COPY_FILE("${tst_xml_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") - endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) + endforeach () foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) get_filename_component(fname "${tst_xml_other_file}" NAME) HDFTEST_COPY_FILE("${tst_xml_other_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") - endforeach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) + endforeach () add_custom_target(h5dump_xml_files ALL COMMENT "Copying files needed by h5dump_xml tests" DEPENDS ${h5dump_xml_files_list}) ############################################################################## @@ -151,11 +151,11 @@ NAME H5DUMP-XML-${skipresultfile}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + endif () + else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) - endif (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_XML_SKIP_H5_TEST) + endif () + ENDMACRO () MACRO (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -167,13 +167,7 @@ if (NOT "${last_xml_test}" STREQUAL "") set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5DUMP-XML-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-XML-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") + else () add_test ( NAME H5DUMP-XML-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -185,9 +179,8 @@ -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS "H5DUMP-XML-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_XML_H5_TEST file) + endif () + ENDMACRO () ############################################################################## ############################################################################## @@ -333,9 +326,9 @@ set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (NOT "${last_xml_test}" STREQUAL "") set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) - endif (NOT "${last_xml_test}" STREQUAL "") + endif () set (last_test "H5DUMP-XML-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () ########## test XML ADD_XML_H5_TEST (tall.h5 0 tall.h5) diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index cee4801..6d95bb2 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -30,6 +30,11 @@ TEST_SCRIPT=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh check_PROGRAMS=$(TEST_PROG) binread check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=h5dump$(EXEEXT) +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5dump_plugin.sh +endif +endif # Our main target, the h5dump tool. bin_PROGRAMS=h5dump @@ -43,6 +48,15 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5) # Source files for the program h5dump_SOURCES=h5dump.c h5dump_ddl.c h5dump_xml.c +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibdump.la + libdynlibdump_la_SOURCES=dynlib_dump.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 83309aa..cc6b465 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -31,6 +31,7 @@ # HDF5 Library Makefile(.in) # + VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -106,6 +107,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = $(am__EXEEXT_1) binread$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5dump_plugin.sh bin_PROGRAMS = h5dump$(EXEEXT) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) subdir = tools/h5dump @@ -117,19 +119,55 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh +CONFIG_CLEAN_FILES = h5dump_plugin.sh testh5dump.sh testh5dumppbits.sh \ + testh5dumpxml.sh CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdynlibdump_la_LIBADD = +am__libdynlibdump_la_SOURCES_DIST = dynlib_dump.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibdump_la_OBJECTS = \ +@HAVE_SHARED_CONDITIONAL_TRUE@ dynlib_dump.lo +libdynlibdump_la_OBJECTS = $(am_libdynlibdump_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibdump_la_rpath = -rpath \ +@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir) am__EXEEXT_1 = h5dumpgentest$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) binread_SOURCES = binread.c binread_OBJECTS = binread.$(OBJEXT) binread_LDADD = $(LDADD) binread_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = am_h5dump_OBJECTS = h5dump.$(OBJEXT) h5dump_ddl.$(OBJEXT) \ h5dump_xml.$(OBJEXT) h5dump_OBJECTS = $(am_h5dump_OBJECTS) @@ -176,8 +214,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = binread.c $(h5dump_SOURCES) h5dumpgentest.c -DIST_SOURCES = binread.c $(h5dump_SOURCES) h5dumpgentest.c +SOURCES = $(libdynlibdump_la_SOURCES) binread.c $(h5dump_SOURCES) \ + h5dumpgentest.c +DIST_SOURCES = $(am__libdynlibdump_la_SOURCES_DIST) binread.c \ + $(h5dump_SOURCES) h5dumpgentest.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -224,33 +264,6 @@ am__tty_colors = { \ std=''; \ fi; \ } -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* @@ -404,10 +417,11 @@ am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testh5dump.sh.in \ - $(srcdir)/testh5dumppbits.sh.in $(srcdir)/testh5dumpxml.sh.in \ - $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ - $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \ +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/h5dump_plugin.sh.in \ + $(srcdir)/testh5dump.sh.in $(srcdir)/testh5dumppbits.sh.in \ + $(srcdir)/testh5dumpxml.sh.in $(top_srcdir)/bin/depcomp \ + $(top_srcdir)/bin/mkinstalldirs $(top_srcdir)/bin/test-driver \ + $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -685,7 +699,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 *.h5 *.bin # Test programs and scripts TEST_PROG = h5dumpgentest -TEST_SCRIPT = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh +TEST_SCRIPT = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh \ + $(am__append_1) check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5dump$(EXEEXT) @@ -697,6 +712,8 @@ LDADD = $(LIBH5TOOLS) $(LIBHDF5) # Source files for the program h5dump_SOURCES = h5dump.c h5dump_ddl.c h5dump_xml.c +@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibdump.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlibdump_la_SOURCES = dynlib_dump.c DISTCLEANFILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh # Automake needs to be taught how to build lib, progs, and tests targets. @@ -752,12 +769,52 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +h5dump_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5dump_plugin.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5dump.sh: $(top_builddir)/config.status $(srcdir)/testh5dump.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5dumppbits.sh: $(top_builddir)/config.status $(srcdir)/testh5dumppbits.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5dumpxml.sh: $(top_builddir)/config.status $(srcdir)/testh5dumpxml.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libdynlibdump_la_rpath) $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -836,6 +893,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binread.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib_dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_ddl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_xml.Po@am__quote@ @@ -1106,9 +1164,11 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1145,10 +1205,11 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SHARED_CONDITIONAL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool mostlyclean-am + clean-libLTLIBRARIES clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -1174,8 +1235,9 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS - +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -1214,25 +1276,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES -.MAKE: check-am install-am install-strip +.MAKE: check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ check-am clean clean-binPROGRAMS clean-checkPROGRAMS \ - clean-generic clean-libtool cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS + uninstall-binPROGRAMS uninstall-libLTLIBRARIES .PRECIOUS: Makefile @@ -1248,6 +1311,11 @@ uninstall-am: uninstall-binPROGRAMS help: @$(top_srcdir)/bin/makehelp +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. + +@HAVE_SHARED_CONDITIONAL_TRUE@install-exec-hook: +@HAVE_SHARED_CONDITIONAL_TRUE@ $(RM) $(DESTDIR)$(libdir)/*dynlib* + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5dump/dynlib_dump.c b/tools/h5dump/dynlib_dump.c new file mode 100644 index 0000000..0d8be2b --- /dev/null +++ b/tools/h5dump/dynlib_dump.c @@ -0,0 +1,94 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* + * Programmer: Raymond Lu + * 13 February 2013 + * + * Purpose: Tests the plugin module (H5PL) + */ + +#include +#include +#include "H5PLextern.h" + +#define H5Z_FILTER_DYNLIB2 258 +#define MULTIPLIER 3 + +static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIB2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib2 + * + * Purpose: A dynlib2 filter method that multiplies the original value + * during write and divide the original value during read. It + * will be built as a shared library. plugin.c test will load + * and use this filter library. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + * Programmer: Raymond Lu + * 29 March 2013 + * + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if(cd_nelmts > 0) + return(0); + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Divide the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ /= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Multiply the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ *= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlib2() */ + diff --git a/tools/h5dump/h5dump_plugin.sh.in b/tools/h5dump/h5dump_plugin.sh.in new file mode 100644 index 0000000..d3274da --- /dev/null +++ b/tools/h5dump/h5dump_plugin.sh.in @@ -0,0 +1,226 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +DUMPER=h5dump # The tool name +DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary + +nerrors=0 +verbose=yes +h5haveexitcode=yes # default is yes + +TEST_NAME=h5dump_ud_plugin +FROM_DIR=`pwd`/.libs +PLUGIN_LIB="$FROM_DIR/libdynlibdump.*" +PLUGIN_LIBDIR=testdir3 + +RM='rm -rf' +GREP='grep' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# source dirs +SRC_TOOLS="$srcdir/../" + +# testfiles source dirs for tools +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" + +TESTDIR=./testplug +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/tudfilter.h5 +$SRC_H5DUMP_TESTFILES/tudfilter.ddl +" + +# RUNSERIAL is used. Check if it can return exit code from executable correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell correctly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + +# Main Body +# Create test directories if not exists yet. +test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to create test directory($PLUGIN_LIBDIR)" + exit $EXIT_FAILURE +fi + +# copy plugin library for test +$CP $PLUGIN_LIB $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB) for test." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp 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 + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + 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=$SRC_H5DUMP_TESTFILES + 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() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# If $1 == ignorecase then do caseless CMP and DIFF. +# ADD_H5_TEST +TOOLTEST() { + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual > /dev/null 2>&1 ; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + fi + +} + +############################################################################## +### T H E T E S T S +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +# Run the test +TOOLTEST tudfilter.ddl --enable-error-stack tudfilter.h5 + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All Plugin API tests passed." + 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/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 058ea90..284e42b 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -113,6 +113,7 @@ #define FILE81 "tints4dims.h5" #define FILE82 "tcompound_complex2.h5" #define FILE83 "tvlenstr_array.h5" +#define FILE84 "tudfilter.h5" /*------------------------------------------------------------------------- * prototypes @@ -152,6 +153,23 @@ const H5Z_class2_t H5Z_MYFILTER[1] = {{ myfilter, /* The actual filter function */ }}; +#define H5Z_FILTER_DYNLIB2 258 +#define MULTIPLIER 3 + +static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIB2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ +}}; + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -618,7 +636,7 @@ static int gent_softlink2(void) fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fileid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1); status = FAIL; goto out; } @@ -629,7 +647,7 @@ static int gent_softlink2(void) gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -637,7 +655,7 @@ static int gent_softlink2(void) gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -649,7 +667,7 @@ static int gent_softlink2(void) status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -677,7 +695,7 @@ static int gent_softlink2(void) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset1 < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -685,7 +703,7 @@ static int gent_softlink2(void) status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); status = FAIL; goto out; } @@ -698,7 +716,7 @@ static int gent_softlink2(void) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset2 < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -706,7 +724,7 @@ static int gent_softlink2(void) status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); status = FAIL; goto out; } @@ -721,7 +739,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -730,7 +748,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -739,7 +757,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -748,7 +766,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -757,7 +775,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -769,7 +787,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -778,7 +796,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -787,7 +805,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -796,7 +814,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -805,7 +823,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -815,31 +833,31 @@ static int gent_softlink2(void) * Close/release resources. */ if(dataspace >= 0 && H5Sclose(dataspace) < 0) { - fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1); status = FAIL; } if(gid1 >= 0 && H5Gclose(gid1) < 0) { - fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); status = FAIL; } if(gid2 >= 0 && H5Gclose(gid2) < 0) { - fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); status = FAIL; } if(datatype >= 0 && H5Tclose(datatype) < 0) { - fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1); status = FAIL; } if(dset1 >= 0 && H5Dclose(dset1) < 0) { - fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); status = FAIL; } if(dset2 >= 0 && H5Dclose(dset2) < 0) { - fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); status = FAIL; } if(fileid1 >= 0 && H5Fclose(fileid1) < 0) { - fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1); status = FAIL; } @@ -915,7 +933,7 @@ static void gent_udlink(void) /* This ud link will dangle, but that's okay */ fid = H5Fcreate(FILE54, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); H5Lcreate_ud(fid, "udlink1", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); - strcpy(buf, "foo"); + HDstrcpy(buf, "foo"); H5Lcreate_ud(fid, "udlink2", (H5L_type_t)MY_LINKCLASS, buf, 4, H5P_DEFAULT, H5P_DEFAULT); H5Fclose(fid); @@ -1820,7 +1838,7 @@ static void gent_str(void) { for(l = 0; l < 10; l++) comp1[i][j].a[k][l] = (l + j + k) * (l + j + k); for(k = 0 ; k < 12; k++) - strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); + HDstrcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); } dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2452,7 +2470,7 @@ static void gent_nestcomp(void) */ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); if(status < 0) - fprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); + HDfprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); /* * Release resources @@ -10119,7 +10137,7 @@ static void gent_vlenstr_array(void) if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); + HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); H5Dclose(dset); } @@ -10132,6 +10150,119 @@ static void gent_vlenstr_array(void) H5Fclose(file); } +/*------------------------------------------------------------------------- + * Function: gent_udfilter + * + * Purpose: Generate a file to be used in testing user defined filter plugin3. + *------------------------------------------------------------------------- + */ +static void gent_udfilter(void) +{ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + + hsize_t dims1[RANK] = {DIM1,DIM2}; + hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; + int buf1[DIM1][DIM2]; + int i, j, n, ret; + + for(i=n=0; i=0); + + /* create a space */ + sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + HDassert(dcpl>=0); + + ret = H5Pset_layout(dcpl, H5D_CHUNKED); + HDassert(ret >= 0); + + ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + HDassert(ret >= 0); + + ret = H5Zregister (H5Z_DYNLIB2); + HDassert(ret >= 0); + + ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL); + HDassert(ret >= 0); + + ret=make_dset(fid, "dynlib2", sid, H5T_NATIVE_INT, dcpl, buf1); + HDassert(ret >= 0); + + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL); + HDassert(ret >= 0); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret = H5Sclose(sid); + HDassert(ret >= 0); + + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + + ret = H5Fclose(fid); + HDassert(ret >= 0); +} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib2 + * + * Purpose: A dynlib2 filter method that multiplies the original value + * during write and divide the original value during read. It + * will be built as a shared library. tools tests will load + * and use this filter as a plugin library. + * + * Return: Success: Data chunk size + * + * Failure: 0 + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if(cd_nelmts > 0) + return(0); + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Divide the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ /= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Multiply the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ *= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlib2() */ + /*------------------------------------------------------------------------- * Function: main @@ -10227,6 +10358,8 @@ int main(void) gent_intsfourdims(); + gent_udfilter(); + return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index a5e8c4e..a9302ef 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -404,10 +404,10 @@ COPY_TESTFILES_TO_TESTDIR() 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 - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -421,7 +421,7 @@ 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` + SDIR=$SRC_H5DUMP_TESTFILES 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 @@ -452,14 +452,14 @@ TESTING() { TOOLTEST() { # check if caseless compare and diff requested if [ "$1" = ignorecase ]; then - caseless="-i" - # replace cmp with diff which runs much longer. - xCMP="$DIFF -i" - shift + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift else - caseless="" - # stick with faster cmp if ignorecase is not requested. - xCMP="$CMP" + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" fi expect="$TESTDIR/$1" @@ -548,7 +548,7 @@ TOOLTEST2() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -556,7 +556,7 @@ TOOLTEST2() { } -# same as TOOLTEST2 but compares generated file to expected ddl file +# same as TOOLTEST2 but compares generated file to expected ddl file # and compares the generated data file to the expected data file # used for the binary tests that expect a full path in -o without -b # ADD_H5_TEST_EXPORT @@ -614,7 +614,7 @@ TOOLTEST2A() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err $actualmeta @@ -653,7 +653,7 @@ TOOLTEST2B() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -870,7 +870,7 @@ TOOLTEST_HELP() { echo " Expected output (*.txt) differs from actual output (*.out)" nerrors="`expr $nerrors + 1`" fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actual_err @@ -883,7 +883,7 @@ SKIP() { TESTING $DUMPER $@ echo " -SKIP-" } - + # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { @@ -894,7 +894,7 @@ PRINT_H5DIFF() { # Call the h5diff tool # -DIFFTEST() +DIFFTEST() { PRINT_H5DIFF $@ ( @@ -908,7 +908,7 @@ DIFFTEST() else echo " PASSED" fi - + } # Print a line-line message left justified in a field of 70 characters @@ -921,7 +921,7 @@ PRINT_H5IMPORT() { # Call the h5import tool # -IMPORTTEST() +IMPORTTEST() { # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" @@ -932,7 +932,7 @@ IMPORTTEST() PRINT_H5IMPORT $@ ( cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? if [ $RET != 0 ] ; then @@ -941,7 +941,7 @@ IMPORTTEST() else echo " PASSED" fi - + } @@ -1032,7 +1032,7 @@ TOOLTEST tcomp-1.ddl --enable-error-stack tcompound.h5 # test for named data types TOOLTEST tcomp-2.ddl --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5 TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5 -# test for unamed type +# test for unamed type TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5 # test complicated compound datatype TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 @@ -1055,7 +1055,7 @@ TOOLTEST tall-7N.ddl --enable-error-stack -N attr1 tall.h5 # test for loop detection TOOLTEST tloop-1.ddl --enable-error-stack tloop.h5 -# test for string +# test for string TOOLTEST tstr-1.ddl --enable-error-stack tstr.h5 TOOLTEST tstr-2.ddl --enable-error-stack tstr2.h5 @@ -1156,7 +1156,7 @@ TOOLTEST tcompact.ddl --enable-error-stack -H -p -d compact tfilters.h5 TOOLTEST tcontiguos.ddl --enable-error-stack -H -p -d contiguous tfilters.h5 # chunked TOOLTEST tchunked.ddl --enable-error-stack -H -p -d chunked tfilters.h5 -# external +# external TOOLTEST texternal.ddl --enable-error-stack -H -p -d external tfilters.h5 # fill values @@ -1225,7 +1225,7 @@ fi # test for displaying objects with very long names TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5 -# dimensions over 4GB, print boundary +# dimensions over 4GB, print boundary TOOLTEST tbigdims.ddl --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5 # hyperslab read @@ -1233,7 +1233,7 @@ TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5 # - + # test for displaying dataset and attribute of null space TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5 @@ -1272,7 +1272,7 @@ IMPORTTEST out3.bin -c tbin3.ddl -o out3D.h5 DIFFTEST tbinary.h5 out3D.h5 /integer /integer TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5 - + # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then rm -f out[1-4].bin @@ -1280,7 +1280,7 @@ if test -z "$HDF5_NOCLEANUP"; then rm -f out3.h5 fi -# test for dataset region references +# test for dataset region references TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 TOOLTEST4 tdataregR.ddl --enable-error-stack -R tdatareg.h5 TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in index 4211c63..446020a 100644 --- a/tools/h5dump/testh5dumppbits.sh.in +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -190,7 +190,7 @@ 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` + SDIR=$SRC_H5DUMP_TESTFILES/pbits 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 diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 1efde85..33a67c0 100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -221,7 +221,7 @@ 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` + SDIR=$SRC_H5DUMP_TESTFILES 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 diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index 139f440..80bd2f7 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_H5LS) #----------------------------------------------------------------------------- @@ -22,6 +22,34 @@ set (H5_DEP_EXECUTABLES if (BUILD_TESTING) + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + include (CMakeTests.cmake) endif (BUILD_TESTING) diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index eda990d..f790ed9 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -29,6 +29,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.h5 ) @@ -86,6 +87,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ls ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ls ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr-1.ls + ${HDF5_TOOLS_DIR}/testfiles/tudfilter.ls ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink-1.ls ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.ls ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2le.ls @@ -98,7 +100,7 @@ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") - endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + endforeach () add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) ############################################################################## @@ -118,14 +120,33 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( - NAME H5LS-${resultfile}-clear-objects + NAME H5LS-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ls" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + ENDMACRO () + + MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5LS_UD-${testname}-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err ) add_test ( - NAME H5LS-${resultfile} + NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" @@ -133,11 +154,13 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST file) + set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clearall-objects) + endif () + ENDMACRO () ############################################################################## ############################################################################## @@ -258,11 +281,25 @@ tvldtypes2be.out tvldtypes2be.out.err ) + set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5LS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () + +# See which filters are usable (and skip tests for filters we +# don't have). Do this by searching H5pubconf.h to see which +# filters are defined. + +# detect whether the encoder is present. + if (H5_HAVE_FILTER_DEFLATE) + set (USE_FILTER_DEFLATE "true") + endif () + + if (H5_HAVE_FILTER_SZIP) + set (USE_FILTER_SZIP "true") + endif () # test the help syntax ADD_H5_TEST (help-1 0 -w80 -h) @@ -393,3 +430,9 @@ else (H5_WORDS_BIGENDIAN) ADD_H5_TEST (tdataregle 0 -v tdatareg.h5) endif (H5_WORDS_BIGENDIAN) + +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -v -d tudfilter.h5) + \ No newline at end of file diff --git a/tools/h5ls/Makefile.am b/tools/h5ls/Makefile.am index 408ce93..bee5d79 100644 --- a/tools/h5ls/Makefile.am +++ b/tools/h5ls/Makefile.am @@ -27,6 +27,11 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib TEST_SCRIPT=testh5ls.sh check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=h5ls$(EXEEXT) +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5ls_plugin.sh +endif +endif # This is our main target, the h5ls tool bin_PROGRAMS=h5ls @@ -37,4 +42,15 @@ h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibls.la + libdynlibls_la_SOURCES=dynlib_ls.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + +DISTCLEANFILES=h5ls_plugin.sh + include $(top_srcdir)/config/conclude.am diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 97fa0c6..317fb8b 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -31,6 +31,7 @@ # HDF5 Library Makefile(.in) # + VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -105,6 +106,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5ls_plugin.sh bin_PROGRAMS = h5ls$(EXEEXT) TESTS = $(TEST_SCRIPT) subdir = tools/h5ls @@ -116,18 +118,53 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = testh5ls.sh +CONFIG_CLEAN_FILES = h5ls_plugin.sh testh5ls.sh CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdynlibls_la_LIBADD = +am__libdynlibls_la_SOURCES_DIST = dynlib_ls.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibls_la_OBJECTS = \ +@HAVE_SHARED_CONDITIONAL_TRUE@ dynlib_ls.lo +libdynlibls_la_OBJECTS = $(am_libdynlibls_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibls_la_rpath = -rpath \ +@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir) PROGRAMS = $(bin_PROGRAMS) h5ls_SOURCES = h5ls.c h5ls_OBJECTS = h5ls.$(OBJEXT) h5ls_LDADD = $(LDADD) h5ls_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = h5ls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(h5ls_LDFLAGS) $(LDFLAGS) -o $@ @@ -165,8 +202,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = h5ls.c -DIST_SOURCES = h5ls.c +SOURCES = $(libdynlibls_la_SOURCES) h5ls.c +DIST_SOURCES = $(am__libdynlibls_la_SOURCES_DIST) h5ls.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -213,33 +250,6 @@ am__tty_colors = { \ std=''; \ fi; \ } -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* @@ -391,9 +401,10 @@ am__set_b = \ *) \ b='$*';; \ esac -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testh5ls.sh.in \ - $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ - $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \ +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/h5ls_plugin.sh.in \ + $(srcdir)/testh5ls.sh.in $(top_srcdir)/bin/depcomp \ + $(top_srcdir)/bin/mkinstalldirs $(top_srcdir)/bin/test-driver \ + $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -667,7 +678,7 @@ TRACE = perl $(top_srcdir)/bin/trace CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # Test programs and scripts -TEST_SCRIPT = testh5ls.sh +TEST_SCRIPT = testh5ls.sh $(am__append_1) check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5ls$(EXEEXT) @@ -676,6 +687,9 @@ h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All programs depend on the hdf5 and h5tools libraries LDADD = $(LIBH5TOOLS) $(LIBHDF5) +@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibls.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlibls_la_SOURCES = dynlib_ls.c +DISTCLEANFILES = h5ls_plugin.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -730,8 +744,48 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +h5ls_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5ls_plugin.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5ls.sh: $(top_builddir)/config.status $(srcdir)/testh5ls.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -792,6 +846,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib_ls.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5ls.Po@am__quote@ .c.o: @@ -1052,9 +1107,11 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1086,13 +1143,16 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SHARED_CONDITIONAL_FALSE@install-exec-hook: clean: clean-am -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -1118,8 +1178,9 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS - +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -1158,24 +1219,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES -.MAKE: check-am install-am install-strip +.MAKE: check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ - check-am clean clean-binPROGRAMS clean-generic clean-libtool \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \ - uninstall uninstall-am uninstall-binPROGRAMS + check-am clean clean-binPROGRAMS clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ + pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-libLTLIBRARIES .PRECIOUS: Makefile @@ -1191,6 +1254,11 @@ uninstall-am: uninstall-binPROGRAMS help: @$(top_srcdir)/bin/makehelp +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. + +@HAVE_SHARED_CONDITIONAL_TRUE@install-exec-hook: +@HAVE_SHARED_CONDITIONAL_TRUE@ $(RM) $(DESTDIR)$(libdir)/*dynlib* + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5ls/dynlib_ls.c b/tools/h5ls/dynlib_ls.c new file mode 100644 index 0000000..0d8be2b --- /dev/null +++ b/tools/h5ls/dynlib_ls.c @@ -0,0 +1,94 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* + * Programmer: Raymond Lu + * 13 February 2013 + * + * Purpose: Tests the plugin module (H5PL) + */ + +#include +#include +#include "H5PLextern.h" + +#define H5Z_FILTER_DYNLIB2 258 +#define MULTIPLIER 3 + +static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIB2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib2 + * + * Purpose: A dynlib2 filter method that multiplies the original value + * during write and divide the original value during read. It + * will be built as a shared library. plugin.c test will load + * and use this filter library. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + * Programmer: Raymond Lu + * 29 March 2013 + * + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if(cd_nelmts > 0) + return(0); + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Divide the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ /= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Multiply the original value with MULTIPLIER */ + while(buf_left > 0) { + *int_ptr++ *= MULTIPLIER; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlib2() */ + diff --git a/tools/h5ls/h5ls_plugin.sh.in b/tools/h5ls/h5ls_plugin.sh.in new file mode 100644 index 0000000..460ff6a --- /dev/null +++ b/tools/h5ls/h5ls_plugin.sh.in @@ -0,0 +1,238 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +H5LS=h5ls # The tool name +H5LS_BIN=`pwd`/$H5LS # The path of the tool binary + +nerrors=0 +verbose=yes +h5haveexitcode=yes # default is yes + +TEST_NAME=ud_plugin +FROM_DIR=`pwd`/.libs +PLUGIN_LIB="$FROM_DIR/libdynlibls.*" +PLUGIN_LIBDIR=testdir3 + +RM='rm -rf' +GREP='grep' +CMP='cmp -s' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# source dirs +SRC_TOOLS="$srcdir/.." + +# testfiles source dirs for tools +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" + +TESTDIR=./testplug +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_TOOLS_TESTFILES/tudfilter.h5 +$SRC_TOOLS_TESTFILES/tudfilter.ls +" + +# RUNSERIAL is used. Check if it can return exit code from executable correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell correctly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + +# Main Body +# Create test directories if not exists yet. +test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to create test directory($PLUGIN_LIBDIR)" + exit $EXIT_FAILURE +fi + +# copy plugin library for test +$CP $PLUGIN_LIB $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB) for test." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp 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 + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + 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=$SRC_H5LS_TESTFILES + 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() { + SPACES=" " + echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012' +} + +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + +# Run a test and print PASS or *FAIL*. For now, if h5ls can complete +# with exit status 0, consider it pass. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display up to $NLINS +# lines of the actual output from the tool test. The actual output is not +# removed if $HDF5_NOCLEANUP has a non-zero value. +# Arguemnts: +# $1 -- actual output filename to use +# $2 and on -- argument for the h5ls tool +TOOLTEST() { + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ls`.out" + actual_err="$TESTDIR/`basename $1 .ls`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + retvalexpect=$1 + shift + + # Run test. + # Stderr is included in stdout so that the diff can detect + # any unexpected output from that stream too. + TESTING $H5LS $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $H5LS_BIN "$@" + ) >$actual 2>$actual_err + + exitcode=$? + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if [ yes = "$verbose" ]; then + echo "test returned with exit code $exitcode" + echo "test output: (up to $NLINES lines)" + head -$NLINES $actual + echo "***end of test output***" + echo "" + fi + elif [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + fi +} + +############################################################################## +### T H E T E S T S +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +# Run the test +TOOLTEST tudfilter.ls 0 -w80 -v -d tudfilter.h5 + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All Plugin API tests passed." + 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/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index bf40bfa..4e138e1 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -17,6 +17,9 @@ srcdir=@srcdir@ +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" + TESTNAME=h5ls EXIT_SUCCESS=0 EXIT_FAILURE=1 @@ -178,10 +181,10 @@ COPY_TESTFILES_TO_TESTDIR() 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 - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -195,7 +198,7 @@ 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` + SDIR=$SRC_H5LS_TESTFILES 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 @@ -236,10 +239,10 @@ TOOLTEST() { # any unexpected output from that stream too. TESTING $H5LS $@ ( - cd $TESTDIR + cd $TESTDIR $RUNSERIAL $H5LS_BIN "$@" - ) >$actual 2>$actual_err - + ) >$actual 2>$actual_err + exitcode=$? # save actual and actual_err in case they are needed later. cp $actual $actual_sav @@ -248,37 +251,37 @@ TOOLTEST() { STDERR_FILTER $actual_err cat $actual_err >> $actual if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if [ yes = "$verbose" ]; then - echo "test returned with exit code $exitcode" - echo "test output: (up to $NLINES lines)" - head -$NLINES $actual - echo "***end of test output***" - echo "" - fi + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if [ yes = "$verbose" ]; then + echo "test returned with exit code $exitcode" + echo "test output: (up to $NLINES lines)" + head -$NLINES $actual + echo "***end of test output***" + echo "" + fi elif [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" cp $actual $expect elif $CMP $expect $actual; then echo " PASSED" else echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # prepare for test @@ -337,7 +340,7 @@ TOOLTEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1 TOOLTEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5 TOOLTEST textlinksrc-7-old.ls 0 -w80 -E textlinksrc.h5/ext_link1 -# tests for no-dangling-links +# tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 TOOLTEST textlinksrc-nodangle-1.ls 1 -w80 --no-dangling-links textlinksrc.h5 @@ -372,7 +375,7 @@ TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5 # test for loop detection TOOLTEST tloop-1.ls 0 -w80 -r -d tloop.h5 -# test for string +# test for string TOOLTEST tstr-1.ls 0 -w80 -r -d tstr.h5 # test test file created from lib SAF team @@ -403,15 +406,15 @@ fi # test for non-existing file TOOLTEST nosuchfile.ls 1 nosuchfile.h5 -# test for variable length data types in verbose mode +# test for variable length data types in verbose mode if test $WORDS_BIGENDIAN != "yes"; then TOOLTEST tvldtypes2le.ls 0 -v tvldtypes1.h5 else TOOLTEST tvldtypes2be.ls 0 -v tvldtypes1.h5 -fi +fi -# test for dataset region references data types in verbose mode +# test for dataset region references data types in verbose mode if test $WORDS_BIGENDIAN != "yes"; then TOOLTEST tdataregle.ls 0 -v tdatareg.h5 else diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 2eb66f9..d7f5cb5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -479,7 +479,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ + opts->err_stat = 1; /* make dangling link is error */ goto done; } @@ -511,7 +511,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ + opts->err_stat = 1; /* make dangling link is error */ goto done; } @@ -592,8 +592,8 @@ hsize_t h5diff(const char *fname1, trav_info_t *info1_grp = NULL; trav_info_t *info2_grp = NULL; /* local pointer */ - trav_info_t *info1_lp; - trav_info_t *info2_lp; + trav_info_t *info1_lp = NULL; + trav_info_t *info2_lp = NULL; /* link info from specified object */ H5L_info_t src_linfo1; H5L_info_t src_linfo2; @@ -1555,7 +1555,7 @@ hsize_t diff(hid_t file1_id, { if (options->no_dangle_links) { - /* gangling link is error */ + /* dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); goto out; @@ -1573,7 +1573,7 @@ hsize_t diff(hid_t file1_id, { if (options->no_dangle_links) { - /* gangling link is error */ + /* dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path2); goto out; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 157978d..17eeafe 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -71,9 +71,7 @@ hsize_t diff_dataset( hid_t file1_id, if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if((dcpl2 = H5Dget_create_plist(did2)) < 0) - { goto error; - } /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -91,6 +89,9 @@ hsize_t diff_dataset( hid_t file1_id, obj2_name, options); } + else + goto error; + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -324,7 +325,7 @@ hsize_t diff_datasetid( hid_t did1, parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + can_compare=0; options->not_cmp=1; } @@ -676,31 +677,30 @@ int diff_can_type( hid_t f_tid1, /* file data type */ HDassert(tclass1==tclass2); switch (tclass1) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_COMPOUND: - case H5T_STRING: - case H5T_ARRAY: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_REFERENCE: - - break; - - default: /*H5T_TIME */ - + case H5T_TIME: + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { + parallel_print("Not comparable: <%s> and <%s> are of class %s\n", + obj1_name,obj2_name,get_class(tclass2) ); + } /* end if */ + can_compare = 0; + options->not_cmp = 1; + return can_compare; - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - { - parallel_print("Not comparable: <%s> and <%s> are of class %s\n", - obj1_name,obj2_name,get_class(tclass2) ); - } - can_compare = 0; - options->not_cmp = 1; - return can_compare; - } + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_COMPOUND: + case H5T_STRING: + case H5T_ARRAY: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_REFERENCE: + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + break; + } /* end switch */ /*------------------------------------------------------------------------- * check for equal file datatype; warning only diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 3928837..665c2e8 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3156,7 +3156,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SZIP: - { szip_options_mask = cd_values[0];; szip_pixels_per_block = cd_values[1]; @@ -3219,7 +3218,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } break; case H5Z_FILTER_NBIT: h5tools_str_append(&buffer, "%s", NBIT); @@ -3389,6 +3387,8 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, case H5D_ALLOC_TIME_LATE: h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); break; + case H5D_ALLOC_TIME_ERROR: + case H5D_ALLOC_TIME_DEFAULT: default: HDassert(0); break; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 7f65c91..e62c7b0 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -736,7 +736,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai long double templdouble; HDmemcpy(&templdouble, vp, sizeof(long double)); - h5tools_str_append(str, "%Lf", templdouble); + h5tools_str_append(str, OPT(info->fmt_double, "%Lf"), templdouble); #endif } break; diff --git a/tools/testfiles/tudfilter.ddl b/tools/testfiles/tudfilter.ddl new file mode 100644 index 0000000..5bdceec --- /dev/null +++ b/tools/testfiles/tudfilter.ddl @@ -0,0 +1,30 @@ +HDF5 "tudfilter.h5" { +GROUP "/" { + DATASET "dynlib2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + (1,0): 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + (2,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + (3,0): 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + (4,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + (5,0): 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + (6,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + (7,0): 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + (8,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + (9,0): 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + (10,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + (11,0): 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + (12,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + (13,0): 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + (14,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + (15,0): 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + (16,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + (17,0): 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + (18,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + (19,0): 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 + } + } +} +} diff --git a/tools/testfiles/tudfilter.h5 b/tools/testfiles/tudfilter.h5 new file mode 100644 index 0000000..a1f6d80 Binary files /dev/null and b/tools/testfiles/tudfilter.h5 differ diff --git a/tools/testfiles/tudfilter.ls b/tools/testfiles/tudfilter.ls new file mode 100644 index 0000000..7ca8682 --- /dev/null +++ b/tools/testfiles/tudfilter.ls @@ -0,0 +1,23 @@ +Opened "tudfilter.h5" with sec2 driver. +dynlib2 Dataset {20/20, 10/10} + Location: 1:800 + Links: 1 + Chunks: {10, 5} 200 bytes + Storage: 800 logical bytes, 800 allocated bytes, 100.00% utilization + Filter-0: dynlib2-258 {} + Type: native int + Data: + (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + (1,9) 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + (3,5) 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + (5,1) 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + (6,7) 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + (8,3) 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + (9,9) 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + (11,2) 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + (12,5) 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + (13,8) 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + (15,1) 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + (16,4) 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + (17,7) 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + (19,0) 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 -- cgit v0.12